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

:root {
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --danger: #d93025;
  --warning: #f9ab00;
  --success: #1e8e3e;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --radius: 12px;
  --nav-height: 64px;
  --header-height: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: var(--header-height);
  display: flex;
  align-items: center;
}

#view-title {
  font-size: 20px;
  font-weight: 600;
}

#views {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
  overflow-y: auto;
}

/* Compact scan view */
#view-scan {
  padding: 12px 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Bottom Navigation */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Form elements */
input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--primary);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 12px;
}

/* Compact scan view form groups */
#view-scan .form-group {
  margin-bottom: 10px;
}

#view-scan .form-group label {
  font-size: 12px;
  margin-bottom: 4px;
}

#view-scan input[type="date"],
#view-scan input[type="number"] {
  padding: 10px 12px;
  font-size: 15px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

/* Compact buttons in scan view */
#view-scan .btn {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
}

/* Shortcuts */
.shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.shortcut-btn {
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.shortcut-btn:active {
  background: var(--primary);
  color: white;
}

/* Scanner */
#scanner-region {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 280px;
}

#scanner-region video {
  border-radius: var(--radius);
  max-height: 280px;
  object-fit: cover;
}

/* Product card */
.product-card {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
}

.product-card .brand {
  font-size: 12px;
  color: var(--text-secondary);
}

.product-card .name {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
}

/* Inventory items */
.inventory-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.inventory-item .item-info {
  flex: 1;
}

.inventory-item .item-name {
  font-weight: 500;
  font-size: 15px;
}

.inventory-item .item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.inventory-item .item-expiry {
  text-align: right;
  margin-left: 12px;
}

.inventory-item .days-left {
  font-size: 14px;
  font-weight: 600;
}

.inventory-item .expiry-date {
  font-size: 11px;
  color: var(--text-secondary);
}

.inventory-item .item-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.inventory-item .item-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

.btn-edit-alert {
  background: #e8f5e9;
  color: var(--success);
}

.btn-consume {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-delete {
  background: #fce8e6;
  color: var(--danger);
}

/* Status colors */
.status-expired { color: var(--danger); }
.status-warning { color: var(--warning); }
.status-safe { color: var(--success); }

/* Alert banner */
.alert-banner {
  background: #fce8e6;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--danger);
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

/* Settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.shortcut-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.shortcut-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 16px;
  font-size: 14px;
  color: var(--primary);
}

.shortcut-tag .remove-shortcut {
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
}

/* New product form */
.new-product-form {
  background: #fff8e1;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.new-product-form h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--warning);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Quantity badge */
.qty-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}
