:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --pay: #16a34a;
  --danger: #dc2626;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 60px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

h1 { font-size: 1.5rem; }

.rate-box { text-align: right; }
.rate-box label { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 2px; }
.rate-input { display: flex; align-items: center; gap: 4px; }
.rate-input input {
  width: 64px; text-align: right; font-weight: 600;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem;
}
.rate-input span { color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.timer { text-align: center; }
.status { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.chrono {
  font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: 1px; margin-bottom: 16px;
}
.btn-toggle {
  width: 100%; border: none; padding: 18px; border-radius: 14px;
  font-size: 1.25rem; font-weight: 700; color: #fff; cursor: pointer;
}
.btn-toggle.start { background: var(--pay); }
.btn-toggle.start:active { background: #15803d; }
.btn-toggle.stop { background: var(--danger); }
.btn-toggle.stop:active { background: #b91c1c; }

.totals { display: flex; gap: 12px; }
.total { flex: 1; text-align: center; }
.total-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.total-value { font-size: 1.5rem; font-weight: 700; }
.total-value.pay { color: var(--pay); }

.list { list-style: none; }
.item {
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.item-info { flex: 1; }
.item-top { font-weight: 600; font-size: .95rem; }
.item-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.item-right { text-align: right; margin-left: 10px; }
.item-hours { font-weight: 700; }
.item-pay { font-size: .85rem; color: var(--pay); }
.item-del {
  background: none; border: none; color: var(--danger); font-size: 1.3rem;
  cursor: pointer; margin-left: 8px; padding: 4px 8px;
}

.auth-screen {
  min-height: 70vh; display: flex; align-items: center; justify-content: center;
}
.auth-card { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.auth-card h2 { text-align: center; }
.auth-card input {
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 1rem; background: #fff;
}
.auth-error { color: var(--danger); font-size: .85rem; text-align: center; min-height: 1em; }
.auth-link {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: .85rem; text-align: center; padding: 8px; width: 100%; margin-top: 8px;
}

.btn-clear {
  display: block; width: 100%; background: none; border: 1px solid var(--danger);
  color: var(--danger); padding: 10px; border-radius: 10px; font-size: .9rem; cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --card: #1e293b; --text: #f1f5f9;
    --muted: #94a3b8; --border: #334155;
  }
  .field input, .rate-input input, .auth-card input { background: #0f172a; color: var(--text); }
}
