:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --primary: #2f9e5c;
  --primary-dark: #22794a;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
h1, h2, h3 { margin-top: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; margin-top: 12px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
}
button:hover { background: var(--primary-dark); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar nav a { margin-right: 16px; color: var(--text); text-decoration: none; font-size: 14px; }
.topbar nav a.active { color: var(--primary); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.month-group { margin-bottom: 18px; }
.month-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; font-weight: 600;
}
.month-sum { color: var(--primary); }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: #eff6ff; color: var(--primary);
}
.row-actions button { margin-top: 0; padding: 4px 10px; font-size: 12px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-cell {
  border: 1px solid var(--border); border-radius: 6px; padding: 6px;
  min-height: 70px; font-size: 12px; background: var(--card);
  min-width: 0; overflow: hidden;
}
.calendar-cell .day-num { color: var(--muted); font-size: 11px; }
.calendar-cell .day-sum { color: var(--primary); font-weight: 600; margin-top: 4px; }
.calendar-cell .site-tag {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calendar-cell.empty { background: transparent; border: none; }


/* Responsive tweaks for phones */
@media (max-width: 640px) {
  .container { padding: 12px 10px; }
  .card { padding: 16px; border-radius: 10px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar {
    flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px;
  }
  .topbar nav { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .topbar nav a { margin-right: 0; }
  table { font-size: 12px; }
  th, td { padding: 6px; }
  .calendar-cell { min-height: 48px; padding: 4px; font-size: 10px; }
  .calendar-cell .day-sum { font-size: 10px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; }
  button { width: 100%; }
  .row-actions button { width: auto; }
}


/* New entry modal + pause button group + FAB */
.fab {
  position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
  border-radius: 50%; background: var(--primary); color: white; font-size: 28px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2); border: none; margin-top: 0; z-index: 200;
  line-height: 1;
}
.fab:hover { background: var(--primary-dark); }
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  align-items: flex-end; justify-content: center; z-index: 300;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: var(--card); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0;
  padding: 20px; max-height: 90vh; overflow-y: auto;
}
@media (min-width: 641px) {
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 16px; }
}
.pause-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.pause-btn {
  margin-top: 0; padding: 10px 4px; font-size: 13px; text-align: center;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}
.pause-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; margin-top: 0; }
.entries-list-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.entries-list-row .place { color: var(--muted); }
