:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-muted: #94a3b8;
  --color-text: #1e293b;
  --radius: 0.5rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
}

#app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

#clerk-sign-in {
  display: flex;
  justify-content: center;
  padding: 4rem 1rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.nav-tab {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-muted);
  transition: background 0.15s, color 0.15s;
}

.nav-tab.active,
.nav-tab:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

/* Timer card */
.timer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.timer-input {
  flex: 1;
  min-width: 180px;
  border: none;
  outline: none;
  font-size: 0.9375rem;
  background: transparent;
  color: var(--color-text);
}

.timer-input::placeholder {
  color: var(--color-muted);
}

.timer-display {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 5rem;
  text-align: right;
}

/* Entries list */
.entries-section h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.5rem 0;
}

.entry-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
  box-shadow: var(--shadow);
}

.entry-desc {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.entry-desc.empty {
  color: var(--color-muted);
  font-style: italic;
}

.entry-meta {
  font-size: 0.8125rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.entry-duration {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.9375rem;
  min-width: 4.5rem;
  text-align: right;
}

.tag-chip {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 500;
}

/* Entry edit modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.15);
}

.modal h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.form-field {
  margin-bottom: 0.875rem;
}

.form-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--color-muted);
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  outline: none;
  color: var(--color-text);
  background: var(--color-bg);
}

.form-field input:focus,
.form-field select:focus {
  border-color: #6366f1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Billing */
.billing-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.billing-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.billing-totals {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4375rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-danger  { background: #ef4444; color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-sm      { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }

[x-cloak] { display: none !important; }
