:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1e2925;
  background: #f5f7f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #27634d;
  --green-dark: #194b39;
  --border: #dce4dc;
  --muted: #5e6c65;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 32px 0 48px;
}

.app-header,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header {
  margin-bottom: 36px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.local-label {
  border: 1px solid #c7d8cb;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--green-dark);
  background: #e8f1e8;
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
}

.tracking-section,
.totals-section,
.history-section {
  margin-bottom: 32px;
}

.auth-section {
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.auth-section h2 {
  margin-bottom: 10px;
}

.auth-loading,
.auth-account {
  margin-bottom: 12px;
  color: var(--muted);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-button {
  min-height: 42px;
  border: 1px solid var(--green-dark);
  border-radius: 10px;
  padding: 0 14px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  font-weight: 650;
}

.auth-button:hover:not(:disabled) {
  background: var(--green-dark);
}

.auth-button:focus-visible {
  outline: 3px solid #e4a841;
  outline-offset: 3px;
}

.auth-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-button-secondary {
  color: var(--green-dark);
  background: #fff;
}

.auth-button-secondary:hover:not(:disabled) {
  color: #fff;
}

.auth-error {
  margin: 12px 0 0;
  border: 1px solid #e5c981;
  border-radius: 10px;
  padding: 12px 14px;
  color: #563e12;
  background: #fff5d9;
  font-size: 0.9rem;
  line-height: 1.45;
}

.sync-status {
  margin: -16px 0 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tracking-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.track-button {
  min-height: 96px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 700;
  transition: background-color 120ms ease, transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.track-button:hover {
  background: var(--green-dark);
}

.track-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--green-dark);
}

.track-button:focus-visible,
.undo-button:focus-visible {
  outline: 3px solid #e4a841;
  outline-offset: 3px;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.total-card {
  display: grid;
  gap: 6px;
  min-height: 78px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.total-name {
  color: var(--muted);
  font-size: 0.8rem;
}

.total-count {
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.undo-button {
  min-height: 40px;
  border: 1px solid #b8c9be;
  border-radius: 10px;
  padding: 0 14px;
  color: var(--green-dark);
  background: #fff;
  cursor: pointer;
  font-weight: 650;
}

.undo-button:disabled {
  color: #89948d;
  background: #edf0ec;
  cursor: not-allowed;
}

.storage-notice {
  margin: 12px 0;
  border: 1px solid #e5c981;
  border-radius: 10px;
  padding: 12px 14px;
  color: #563e12;
  background: #fff5d9;
  font-size: 0.9rem;
  line-height: 1.45;
}

.event-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  background: #fff;
}

.event-type {
  font-weight: 700;
}

.event-time {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.empty-state {
  margin: 16px 0 0;
  color: var(--muted);
}

.announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding-top: 24px;
  }

  .app-header {
    align-items: flex-start;
    margin-bottom: 28px;
  }

  .local-label {
    max-width: 142px;
    padding: 7px 10px;
  }

  .total-card {
    min-height: 70px;
  }

  .total-name {
    font-size: 0.72rem;
  }
}
