:root {
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --primary-color: #10b981;
  --primary-hover: #059669;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --danger-color: #ef4444;
  --border-radius: 16px;
  --nav-height: 80px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  /* Prevent body scroll, handle in views */
  display: flex;
  flex-direction: column;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

#view-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* Views */
.view {
  min-height: 100%;
  padding: 20px;
  padding-bottom: calc(var(--nav-height) + 20px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.view-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Navigation */
#main-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--primary-color);
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

/* Scanner */
.scanner-view {
  padding: 0;
  background: black;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#reader {
  width: 100%;
  flex: 1;
  background: black;
  overflow: hidden;
}

.scanner-overlay {
  position: absolute;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  padding: 24px;
  text-align: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
}

.scanner-overlay h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.scanner-overlay p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input {
  width: 100%;
  padding: 16px;
  background: var(--surface-color);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  color: white;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--primary-color);
}

.row {
  display: flex;
  gap: 16px;
}

.row .form-group {
  flex: 1;
}

/* Cards & Info */
.info-card {
  background: rgba(16, 185, 129, 0.1);
  /* Low opacity primary */
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 30px;
}

.info-label {
  color: var(--primary-color);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.info-value {
  color: var(--primary-color);
  font-size: 32px;
  font-weight: 700;
}

.stat-card {
  flex: 1;
  background: var(--surface-color);
  padding: 16px;
  border-radius: var(--border-radius);
  text-align: center;
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card .label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

/* Lists */
.receipt-list {
  list-style: none;
}

.receipt-item {
  background: var(--surface-color);
  padding: 16px;
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.receipt-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.receipt-info .date {
  font-size: 12px;
  color: var(--text-secondary);
}

.receipt-amt {
  text-align: right;
}

.receipt-amt .claim {
  color: var(--primary-color);
  font-weight: 700;
  display: block;
}

.receipt-amt .total {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--border-radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--primary-color);
  color: white;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Scanner styles override */
#reader__scan_region {
  background: transparent !important;
}

/* Login View */
.login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.login-container {
  width: 100%;
  max-width: 320px;
}

.logo-circle {
  width: 96px;
  height: 96px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 24px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.logo-circle svg {
  color: white;
  width: 48px;
  height: 48px;
}

.login-container h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-container p {
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Settings */
.settings-group {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 24px;
}

.settings-group h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.setting-label {
  font-size: 15px;
}

.setting-value {
  color: var(--primary-color);
  font-weight: 600;
}

.version {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 40px;
}

/* OCR Preview */
#ocr-preview {
  background: rgba(0, 0, 0, 0.8);
  border-radius: var(--border-radius);
  padding: 12px;
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ocr-status {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 500;
}

.entry-actions {
  margin-bottom: 24px;
}

.has-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn.small {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

.btn.warning {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}