:root {
  --bg: #eef3f5;
  --panel: #fbfcfd;
  --line: #cfd9df;
  --text: #111827;
  --muted: #667085;
  --blue: #2388c7;
  --green: #21a861;
  --red: #c0392b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-logo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 58% 52%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.18);
  background: #fff;
}
.topbar span { color: var(--muted); margin-left: 8px; }
.topbar nav { display: flex; gap: 4px; }
.topbar a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
}
.topbar a.active {
  background: #e8f1f8;
  border-color: #b9cedd;
}

main {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 14px;
}
.panel, .hero, .summary-grid article, .day-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.flash {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #e9f9ea;
  border: 1px solid #a7d8a9;
}
.flash.error {
  background: #fdecec;
  border-color: #e79797;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.hero h1 { margin: 0; font-size: 26px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.month-nav { display: flex; gap: 6px; }
.month-nav a, button {
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 9px 12px;
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.month-nav a:nth-child(2) { background: #7f8c8d; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.summary-grid article {
  padding: 14px;
}
.summary-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}
.summary-grid strong {
  font-size: 24px;
}

.calendar-list {
  display: grid;
  gap: 8px;
}
.day-card {
  padding: 9px 10px;
}
.day-card.inactive {
  opacity: 1;
  background: #e5ebef;
  padding: 4px 8px;
  border-color: #d5dde3;
  box-shadow: none;
}
.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.day-card.inactive .day-head {
  margin-bottom: 0;
}
.day-card.inactive .day-head strong,
.day-card.inactive .day-head span,
.day-card.inactive .day-head b,
.day-card.inactive .muted {
  color: #7b8790;
  font-size: 11px;
}
.day-card.inactive .day-head b {
  display: none;
}
.day-card.inactive .muted {
  display: none;
}
.day-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.day-head b {
  background: #e8f1f8;
  padding: 6px 9px;
  border-radius: 999px;
}

.day-form {
  display: grid;
  grid-template-columns: 130px 130px 1fr auto;
  gap: 7px;
  align-items: end;
}
label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}
input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 9px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
input:focus {
  outline: 2px solid #b9ddf3;
  border-color: var(--blue);
}
.delete-form {
  margin-top: 8px;
}
.delete-form button {
  background: var(--red);
}
.muted { color: var(--muted); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-box, .narrow {
  width: min(420px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px;
}
.login-form, .password-form {
  display: grid;
  gap: 12px;
}

@media (max-width: 700px) {
  body { font-size: 14px; }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }
  .app-logo {
    width: 44px;
    height: 44px;
  }
  .topbar span {
    display: block;
    margin: 3px 0 0;
    font-size: 12px;
  }
  .topbar nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .topbar a { text-align: center; }
  main { padding: 10px; }
  .hero {
    align-items: stretch;
    flex-direction: column;
  }
  .hero h1 { font-size: 22px; }
  .month-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .month-nav a {
    text-align: center;
    padding: 9px 6px;
  }
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .summary-grid article {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 11px;
  }
  .summary-grid strong { font-size: 20px; }
  .day-form {
    grid-template-columns: 1fr 1fr;
  }
  .note-field,
  .day-form button {
    grid-column: 1 / -1;
  }
  .delete-form {
    display: grid;
  }
}
