:root {
  --bg: #f7f7f8;
  --fg: #1a1a1e;
  --card: #ffffff;
  --accent: #2563eb;
  --muted: #6b7280;
  --danger: #dc2626;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

h1 {
  font-size: 1.4rem;
}

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

button {
  font: inherit;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
}

button.link {
  background: none;
  color: var(--accent);
  padding: 0.25rem;
}

input,
select {
  font: inherit;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  background: var(--card);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.error {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.receipt-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.receipt-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.receipt-list .thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.receipt-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.receipt-info .merchant {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount {
  font-weight: 600;
  white-space: nowrap;
}

.hidden {
  display: none;
}

.receipt-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

button.danger {
  background: none;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.button-link {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}

.export-link {
  display: block;
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.capture-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

button.secondary {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.preview img {
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #e5e7eb;
  margin-top: 0.75rem;
}

.receipt-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.receipt-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
