:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --warn-bg: #fff7e6;
  --warn-border: #f5a524;
  --border: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1e2127;
    --text: #f2f3f5;
    --muted: #9aa1ac;
    --accent: #3b82f6;
    --accent-text: #ffffff;
    --danger: #f87171;
    --warn-bg: #2a2210;
    --warn-border: #b8860b;
    --border: #30343c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
}

.wrap {
  width: 100%;
  max-width: 480px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 14px;
}

button {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 400;
  margin-top: 8px;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -6px 0 12px;
}

.status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.in {
  background: #dcfce7;
  color: #166534;
}
.status-pill.out {
  background: #f1f2f4;
  color: var(--muted);
}
@media (prefers-color-scheme: dark) {
  .status-pill.in { background: #14351f; color: #4ade80; }
  .status-pill.out { background: #2a2d33; color: var(--muted); }
}

.elapsed {
  font-size: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 20px;
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.history li:last-child { border-bottom: none; }

.muted { color: var(--muted); }

.reminder-banner {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.reminder-banner.show { display: block; }

.reminder-banner strong { display: block; margin-bottom: 4px; }

.top-link {
  text-align: center;
  margin-top: 8px;
  font-size: 0.85rem;
}

.top-link a { color: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.tiles {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.15s;
}

.tile:hover {
  border-color: var(--accent);
}

.tile-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.tile-desc {
  font-size: 0.85rem;
  color: var(--muted);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.inline-form input,
.inline-form select {
  width: auto;
  flex: 1 1 140px;
  margin-bottom: 0;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.small-btn {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  flex: 0 0 auto;
}

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

.table-scroll {
  overflow-x: auto;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-edit-input {
  width: auto;
  margin-bottom: 0;
  padding: 4px 6px;
  font-size: 0.82rem;
}

.legal-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 20px;
  line-height: 1.4;
}
