:root {
  color-scheme: light;
  --bg: #fefce8;
  --card: #ffffff;
  --border: #e9e0c8;
  --text: #1c2333;
  --muted: #6c768f;
  --primary: #e6b800;
  --primary-dark: #c9a227;
  --accent: #fff8e1;
  --accent-violet: #7c3aed;
  --accent-violet-light: #ede9fe;
  --shadow: 0 12px 30px rgba(124, 58, 237, 0.12);
  --radius: 16px;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.coffee-banner {
  display: block;
  width: 100%;
  padding: 18px 24px;
  background: #5d4037;
  color: #fff8e1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.coffee-banner:hover {
  background: #4e342e;
  color: #fff;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

/* Receipt paper: center content looks like a printed receipt */
.receipt-paper {
  background: #fffef5;
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 3px
    );
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 32px;
  border: 1px solid #e0d8c8;
  border-radius: 4px;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-family: "Lucida Console", "Courier New", monospace;
  position: relative;
}

.receipt-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 8px,
    #e0d8c8 8px,
    #e0d8c8 10px
  );
  border-radius: 4px 4px 0 0;
}

.receipt-paper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 8px,
    #e0d8c8 8px,
    #e0d8c8 10px
  );
  border-radius: 0 0 4px 4px;
}

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

.receipt-paper .card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 2px;
  border: 1px dashed #d0c8b8;
  box-shadow: none;
  padding: 20px;
  font-size: 13px;
}

.receipt-paper .card-header h3,
.receipt-paper .hero h2 {
  font-family: "Lucida Console", "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.95em;
}

.receipt-paper .muted {
  font-size: 12px;
}

.receipt-paper .preview-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px dashed #d0c8b8;
  border-radius: 2px;
}

.receipt-paper .upload-zone {
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed #d0c8b8;
  font-size: 12px;
}

.receipt-paper .upload-item,
.receipt-paper .match-card,
.receipt-paper .category {
  border: 1px dashed #d0c8b8;
  border-radius: 2px;
  font-size: 12px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
  gap: 24px;
}

.hero h2 {
  margin-top: 0;
  font-size: 28px;
}

.hero p {
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.hero-preview {
  display: flex;
  justify-content: center;
}

.preview-card {
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-violet-light) 100%);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
  border: 2px dashed var(--accent-violet);
}

.preview-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.preview-pill {
  margin-top: 12px;
  background: var(--accent-violet-light);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  width: fit-content;
  border: 1px solid var(--accent-violet);
  color: #5b21b6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-header h3 {
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.bank-select-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bank-select-row label {
  font-weight: 600;
  font-size: 14px;
}

.bank-select-row select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--card);
  min-width: 180px;
}

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

.upload-zone {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 18px;
  background: #fffef5;
  position: relative;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
}

.upload-item span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.match-list-wrap {
  overflow-x: auto;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 16px;
  font-size: 14px;
}

.match-card--confirmed {
  border-left: 4px solid #059669;
  background: linear-gradient(to right, rgba(5, 150, 105, 0.06), var(--card));
}

.match-card--possible {
  border-left: 4px solid #d97706;
  background: linear-gradient(to right, rgba(217, 119, 6, 0.06), var(--card));
}

.match-card--none {
  border-left: 4px solid var(--muted);
}

.match-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.match-status {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
}

.match-status--confirmed {
  background: #d1fae5;
  color: #065f46;
}

.match-status--possible {
  background: #fef3c7;
  color: #92400e;
}

.match-status--none {
  background: #f3f4f6;
  color: var(--muted);
}

.match-explanation {
  color: var(--muted);
  font-size: 13px;
}

.match-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

.match-statement,
.match-receipt {
  padding: 12px;
  border-radius: 12px;
  background: #fffef5;
  border: 1px solid var(--border);
}

.match-statement-label,
.match-receipt-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.match-statement-date,
.match-receipt-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.match-statement-desc,
.match-receipt-merchant {
  font-weight: 500;
  word-break: break-word;
  margin-bottom: 6px;
}

.match-statement-amount,
.match-receipt-amount {
  font-size: 18px;
  font-weight: 700;
  color: #b8860b;
}

.match-receipt-file {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.match-receipt--none .match-receipt-empty {
  color: var(--muted);
  font-style: italic;
}

.match-vs {
  color: var(--muted);
  font-size: 18px;
  padding-top: 24px;
  text-align: center;
}

.match-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.match-category-label {
  font-weight: 600;
  font-size: 13px;
}

.match-category-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--card);
  min-width: 140px;
}

@media (max-width: 700px) {
  .match-comparison {
    grid-template-columns: 1fr;
  }

  .match-vs {
    padding: 0;
    transform: rotate(90deg);
  }
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.category {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.category-title {
  font-weight: 600;
}

.category-amount {
  font-size: 18px;
  margin: 6px 0;
}

.category-detail {
  color: var(--muted);
  font-size: 12px;
}

.export {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.export-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border-radius: 10px;
  border: none;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #d4a017 100%);
  color: #1c2333;
  box-shadow: 0 4px 14px rgba(230, 184, 0, 0.35);
}

button.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #b8860b 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.ghost:hover {
  border-color: var(--accent-violet);
  background: var(--accent-violet-light);
  color: #5b21b6;
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.status-line {
  font-size: 13px;
  color: #b8860b;
}

.status-line.error {
  color: #c53030;
}

.table-empty {
  padding: 16px;
  grid-column: 1 / -1;
}

.cell-category {
  display: flex;
  align-items: center;
}

.category-select {
  width: 100%;
  max-width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--card);
}

.upload-zone.dragover {
  border-color: var(--accent-violet);
  background: var(--accent-violet-light);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
  line-height: 1.6;
  color: var(--text);
}

.modal-body ol {
  margin: 12px 0 0;
  padding-left: 20px;
}

.modal-body li {
  margin-bottom: 8px;
}

.month-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.month-picker-row label {
  font-weight: 600;
  font-size: 14px;
  min-width: 48px;
}

.month-picker-row select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--card);
  min-width: 140px;
}

.month-picker-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

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

.camera-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.camera-overlay.hidden {
  display: none !important;
}

.camera-modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 640px;
  width: 100%;
  overflow: hidden;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.camera-header h3 {
  margin: 0;
  font-size: 18px;
}

.camera-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#camera-video {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  background: #000;
  border-radius: 8px;
  object-fit: cover;
}

.camera-actions {
  display: flex;
  gap: 12px;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 12px 28px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.footer-brand:hover {
  color: var(--accent-violet);
}

.footer-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.footer-contact {
  margin: 0;
  padding: 20px 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  max-width: 640px;
  line-height: 1.5;
  background: var(--accent-violet-light);
  border: 1px solid var(--accent-violet);
  border-radius: var(--radius);
}

.footer-contact a {
  color: var(--accent-violet);
  font-weight: 700;
  text-decoration: none;
}

.footer-contact a:hover {
  text-decoration: underline;
}


