:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --card: #ffffff;
  --text: #27231f;
  --muted: #766f66;
  --primary: #2f7d68;
  --primary-dark: #225b4c;
  --border: #e3ddd2;
  --danger: #9f3131;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
header { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: .8rem 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
a { color: var(--primary-dark); text-decoration: none; }
.brand { font-weight: 800; color: var(--text); }
nav { display: flex; align-items: center; gap: .75rem; font-size: .95rem; }
main { max-width: 880px; margin: 0 auto; padding: 1rem; }
.hero { background: linear-gradient(135deg, #2f7d68, #6aa58d); color: white; padding: 1.4rem; border-radius: 22px; margin-bottom: 1rem; box-shadow: 0 10px 25px rgba(47,125,104,.2); }
.hero h1 { margin: 0 0 .3rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 1rem; margin: 0 0 1rem; box-shadow: 0 6px 20px rgba(35,31,26,.05); }
.error { border-color: #e5b1b1; color: var(--danger); }
.muted { color: var(--muted); }
.date-big { font-size: 1.15rem; font-weight: 700; }
.actions, .tabs, .calendar-head { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.button, button { appearance: none; border: 0; border-radius: 14px; background: var(--primary); color: white; padding: .85rem 1rem; font-weight: 750; cursor: pointer; font-size: 1rem; display: inline-block; }
.button.primary { background: var(--primary); }
.button:not(.primary), button.secondary { background: #e9f2ee; color: var(--primary-dark); }
button.link, .link { background: transparent; color: var(--primary-dark); padding: 0; border-radius: 0; font-weight: 650; }
form.inline { display: inline; }
label { display: block; font-weight: 700; margin: .8rem 0; }
input, select, textarea { width: 100%; margin-top: .35rem; border: 1px solid var(--border); border-radius: 14px; padding: .9rem; font: inherit; background: white; }
textarea { min-height: 92px; resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 16px; margin: 1rem 0; }
.radio { font-weight: 600; display: flex; align-items: center; gap: .6rem; }
.radio input { width: auto; margin: 0; }
ul.visits { list-style: none; padding: 0; margin: 0; }
ul.visits li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--border); }
ul.visits li:first-child { border-top: 0; }
.item-actions { white-space: nowrap; display: flex; gap: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips span, .chip-link {
  display: inline-flex;
  align-items: center;
  background: #eaf6f1;
  border: 1px solid #a7d7c6;
  padding: .52rem .8rem;
  border-radius: 999px;
  color: var(--primary-dark);
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(47, 125, 104, .08);
}
.day-title { display: flex; justify-content: space-between; align-items: center; }
.day-title a { background: var(--primary); color: white; border-radius: 999px; width: 2rem; height: 2rem; display: grid; place-items: center; font-weight: 900; }
.tabs a { padding: .7rem 1rem; border-radius: 999px; background: #eee7db; color: var(--text); font-weight: 800; }
.tabs a.active { background: var(--primary); color: white; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.month-grid > div { text-align: center; color: var(--muted); font-weight: 800; padding: .3rem; }
.month-cell { min-height: 78px; background: white; border: 1px solid var(--border); border-radius: 14px; padding: .45rem; color: var(--text); display: flex; flex-direction: column; gap: .2rem; overflow: hidden; }
.month-cell small { font-size: .68rem; color: var(--primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-cell.has-visit { background: #eaf6f1; border-color: #a7d7c6; }
.month-cell.today { outline: 3px solid #f0c66c; }
.month-cell.muted-cell { opacity: .45; }
.person-row { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: center; border-top: 1px solid var(--border); padding: .8rem 0; }
.person-row form:last-child { grid-column: 1 / -1; display: flex; gap: .5rem; }
.person-row input { margin: 0; }
@media (max-width: 640px) {
  header { align-items: flex-start; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
  main { padding: .75rem; }
  .card, .hero { border-radius: 18px; }
  .actions .button { flex: 1; text-align: center; }
  .month-grid { gap: .22rem; }
  .month-cell { min-height: 64px; padding: .3rem; border-radius: 10px; }
  .month-cell small { display: none; }
  ul.visits li { align-items: flex-start; flex-direction: column; }
}
