@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #F1F4EE;
  --surface: #FFFFFF;
  --ink: #202A1E;
  --ink-soft: #5B6459;
  --ink-faint: #8B9285;
  --accent: #3F8556;
  --accent-dark: #2E6A41;
  --accent-soft: #DCEBDD;
  --line: #E4E7DF;
  --danger: #B5544A;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Public Sans", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.font-display {
  font-family: "Fraunces", Georgia, serif;
}

button, input, textarea, select {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ---------- Layout ---------- */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.topbar .logo {
  font-size: 22px;
}

.topbar button {
  color: var(--ink-soft);
  padding: 4px;
}

main {
  flex: 1;
  padding: 20px 16px 96px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  border-radius: 10px;
}

.bottom-nav .nav-item.active {
  color: var(--accent-dark);
}

@media (min-width: 900px) {
  #app { flex-direction: row; }
  .sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
  }
  .sidebar .logo { font-size: 26px; margin-bottom: 28px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-soft);
  }
  .sidebar .nav-item.active { background: var(--accent-soft); color: var(--accent-dark); }
  .sidebar .nav-item svg { width: 18px; height: 18px; }
  .topbar, .bottom-nav { display: none; }
  main { padding: 32px 40px; max-width: 900px; }
}

/* ---------- Cards / components ---------- */

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(32, 42, 30, 0.06);
}

.hero {
  background: var(--accent);
  color: white;
  border-radius: 18px;
  padding: 22px;
}
.hero .date { font-size: 13px; opacity: 0.85; }
.hero .greeting { font-size: 26px; margin: 4px 0 10px; }
.hero .status { font-size: 13px; opacity: 0.95; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.tile {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  transition: background 0.15s;
}
.tile.disabled { opacity: 0.65; }
.tile:not(.disabled):hover { background: #eef3ea; }
.tile.accent { background: var(--accent); }
.tile svg { color: var(--accent); width: 26px; height: 26px; }
.tile.accent svg { color: white; }
.tile .tile-label { font-weight: 500; margin-top: 18px; }
.tile.accent .tile-label { color: white; }
.tile .tile-desc { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.tile.accent .tile-desc { color: rgba(255,255,255,0.8); }

h1.page-title { font-family: "Fraunces", serif; font-size: 26px; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }

/* ---------- Forms ---------- */

input[type="text"], input[type="password"], input[type="datetime-local"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-secondary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-text {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 14px;
}

/* ---------- Reminders ---------- */

.reminder-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 8px;
}
.reminder-check {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--line);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reminder-check.done { background: var(--accent); border-color: var(--accent); }
.reminder-check svg { width: 12px; height: 12px; color: white; }
.reminder-body { flex: 1; min-width: 0; }
.reminder-title { font-size: 14px; font-weight: 500; }
.reminder-title.done { text-decoration: line-through; color: var(--ink-faint); }
.reminder-notes { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.reminder-meta { font-size: 12px; color: var(--ink-faint); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.reminder-actions { display: flex; gap: 2px; flex-shrink: 0; }
.reminder-actions button { padding: 6px; border-radius: 8px; color: var(--ink-faint); }
.reminder-actions button:hover { background: var(--bg); color: var(--ink); }

.section-label { font-size: 12px; font-weight: 600; color: var(--ink-faint); margin: 18px 0 8px; }

.empty-state { text-align: center; color: var(--ink-faint); font-size: 14px; padding: 40px 0; }

.push-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed rgba(63,133,86,0.5);
  background: rgba(220,235,221,0.5);
  color: var(--accent-dark);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  font-size: 13px;
  width: 100%;
  text-align: left;
}

/* ---------- Settings ---------- */

.settings-section { margin-bottom: 16px; }
.settings-section .settings-title { font-weight: 500; }
.settings-section .settings-desc { font-size: 13px; color: var(--ink-soft); margin: 2px 0 12px; }

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  text-align: center;
}
.login-card input {
  text-align: center;
  letter-spacing: 4px;
  font-size: 18px;
  margin: 20px 0 8px;
}
.login-error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

/* ---------- Modal overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(32,42,30,0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
@media (min-width: 640px) {
  .overlay { align-items: center; }
}
.overlay .card {
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  max-height: 90vh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .overlay .card { border-radius: 20px; }
}
