:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6e6e73;
  --border: #e0e0e2;
  --primary: #0a7d5c;
  --primary-dark: #066447;
  --danger: #d33;
  --danger-dark: #b32222;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --surface: #2c2c2e;
    --text: #f2f2f2;
    --text-muted: #a0a0a5;
    --border: #3a3a3c;
    --primary: #21c98a;
    --primary-dark: #1aa873;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
}

.total-earned {
  font-weight: 600;
  color: var(--primary);
  font-size: 15px;
}

.entries-list {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.entry-card:active {
  transform: scale(0.99);
}

.entry-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entry-date {
  font-weight: 600;
  font-size: 15px;
}

.entry-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.entry-earned {
  font-weight: 700;
  font-size: 17px;
  color: var(--primary);
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  margin-top: 60px;
  font-size: 15px;
}

.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 20;
}

.fab:hover {
  background: var(--primary-dark);
}

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

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

.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

#entryForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#entryForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

#entryForm input {
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.time-row {
  display: flex;
  gap: 12px;
}

.time-row label {
  flex: 1;
}

.computed-total {
  font-size: 14px;
  color: var(--text-muted);
  min-height: 18px;
}

.computed-total strong {
  color: var(--primary);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.modal-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

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

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

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .app-header {
    padding: 14px 16px;
  }

  .modal {
    padding: 20px;
  }
}
