:root {
  --primary: #2e7d5e;
  --primary-dark: #1f5c44;
  --bg: #f4f1e8;
  --card-bg: #ffffff;
  --border: #e2ddcf;
  --text: #24291f;
  --muted: #75806e;
  --danger: #b3432b;
  --warn: #c98a1f;
  --good: #2e7d5e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary-dark); }

.shell { min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 18px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tabs a.active, .tabs a:hover { background: var(--primary); color: #fff; }
.user-chip { font-size: 13px; color: var(--muted); }

.content { max-width: 960px; margin: 0 auto; padding: 24px; }
.content h1 { font-size: 22px; margin: 0 0 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.card-label { font-size: 13px; color: var(--muted); }
.card-value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.card-value.good { color: var(--good); }

.panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 13px; }

.reminder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reminder-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; background: #faf9f4; }
.reminder-list li.soon { background: #fdf3e3; }
.reminder-list li.overdue { background: #fbe9e5; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; }
.bar-track { background: #eee; border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; }
.bar-value { font-size: 13px; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #faf9f4; font-weight: 700; color: var(--muted); }
.row-actions a { margin-right: 10px; font-size: 12px; }
.tag { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; }

.toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); text-decoration: none; cursor: pointer; font-size: 14px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.btn.small { padding: 5px 10px; font-size: 12px; }

.form { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form input, .form select, .form textarea {
  font-family: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); color: var(--text);
}
.form textarea { min-height: 70px; resize: vertical; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 40px; text-align: center; width: 320px; }
.login-icon { font-size: 40px; }
.login-card h1 { margin: 8px 0 2px; }
.login-card p { color: var(--muted); margin-bottom: 20px; }
#g_id_signin { display: flex; justify-content: center; }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; }

.loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-title { font-weight: 800; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-grid-labels { margin-bottom: 6px; }
.cal-daylabel { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-cell {
  min-height: 84px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell.has-events { background: #faf9f4; }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-event {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .topbar { padding: 12px; }
  .content { padding: 16px; }
  .bar-row { grid-template-columns: 1fr; }
  .cal-cell { min-height: 56px; }
  .cal-event { font-size: 9px; }
}
