:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #172b28;
  background: #f5f6f2;
  line-height: 1.45;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  min-height: 68px;
  padding: 10px max(4vw, 18px);
  background: white;
  color: #373460;
  border-bottom: 1px solid #dedde9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 750; }
.brand { min-width: 0; flex-shrink: 1; }
.brand-logo { display: block; width: 300px; max-width: 100%; height: auto; }
.brand-mark { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #e0eabd; color: #172b28; }
.session, .actions, .spacebar, nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
main { width: min(1120px, 100% - 32px); margin: 24px auto 56px; }
.layout { display: block; margin-top: 26px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.spacebar { align-items: end; }
.card { padding: 18px; border-radius: 14px; border: 1px solid #d9e0d7; background: white; }
.login { width: min(100%, 450px); margin: 40px auto; }
.list { display: grid; gap: 9px; margin-top: 12px; }
.item { overflow-wrap: anywhere; }
.item p { margin: 4px 0; }
.item .actions { margin-top: 10px; }
.preserve { white-space: pre-wrap; }
.muted { color: #536860; font-size: .92rem; }
.overdue { color: #8e3426; font-weight: 650; }
.status { padding: 12px; border-radius: 8px; color: #184135; background: #e4f3df; }
.status.error { color: #802819; background: #fbeae5; }
h1, h2, h3, p { margin: 0 0 10px; }
h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.1rem; }
button, input, select, textarea, .button, .upload { font: inherit; }
button, .button, .upload {
  min-height: 42px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #b9cbc0;
  border-radius: 8px;
  background: #fff;
  color: #173f36;
  font-weight: 640;
  padding: 7px 11px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover, .upload:hover { background: #edf4e8; }
button[aria-pressed="true"] { background: #e0eabd; border-color: #819576; }
button:disabled { cursor: wait; opacity: .7; }
.primary { background: #215e4e; color: white; border-color: #215e4e; }
.primary:hover { background: #184c3e; }
.link { margin-top: 8px; border-color: transparent; }
label { display: block; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 43px;
  padding: 8px;
  border: 1px solid #acbeb3;
  border-radius: 7px;
  color: #172b28;
  background: #fff;
}
input[type="file"] { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; padding: 0; }
.upload { position: relative; }
:focus-visible, .upload:focus-within { outline: 3px solid #799749; outline-offset: 2px; }
form, #modal-body { display: grid; gap: 12px; }
textarea { resize: vertical; }
#date-selector { max-width: 200px; margin-top: 12px; }
dialog { max-width: min(94vw, 550px); width: 100%; max-height: 85vh; border: 1px solid #c8d8ce; border-radius: 14px; color: #172b28; }
dialog::backdrop { background: #142521a0; }
@media (max-width: 720px) {
  header { flex-wrap: wrap; padding: 10px 16px; }
  .brand { width: min(260px, 100%); }
  .session { margin-left: auto; }
  .layout { grid-template-columns: 1fr; }
  .session { justify-content: flex-end; }
  header button { min-height: 38px; padding: 4px 8px; }
  .card { padding: 14px; }
}
/* Calendar */
.calendar-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 20px 0 14px; }
.calendar-toolbar h2 { margin: 0; text-transform: capitalize; flex: 1; }
.calendar-toolbar #date-selector { margin: 0; max-width: 170px; font-size: .78rem; }
.calendar-toolbar .actions { flex-wrap: nowrap; }
.calendar-toolbar button { min-width: 40px; }
.calendar-content { min-width: 0; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid #dfe3ed; border-radius: 12px; overflow: hidden; background: #fff; }
.weekday { text-align: center; padding: 10px 2px; color: #616478; background: #f7f8fc; font-size: .8rem; font-weight: 650; }
.month-day { min-height: 125px; min-width: 0; padding: 5px; border-top: 1px solid #e5e7ef; border-right: 1px solid #e5e7ef; }
.month-day:nth-child(7n) { border-right: 0; }
.outside-month { background: #f7f8fa; color: #777; }
.day-number { display: flex; min-height: 30px; width: 30px; padding: 0; border: 0; border-radius: 50%; font-size: .85rem; background: transparent; margin-bottom: 5px; color: inherit; }
.is-today .day-number { background: #45409a; color: #fff; }
.calendar-event { display: block; width: 100%; min-height: 25px; margin: 3px 0; padding: 3px 6px; text-align: left; font-weight: 550; font-size: .77rem; line-height: 1.35; border: 0; border-left: 3px solid #5852b6; border-radius: 4px; background: #eeedfa; color: #333064; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calendar-event:hover { background: #dedbf6; }
.event-time { font-size: .68rem; margin-right: 5px; }
.event-title { font-weight: 650; }
.event-completed { opacity: .65; text-decoration: line-through; }
.event-overdue { border-left-color: #b55043; background: #fcece8; color: #86382b; }
.more-events { min-height: 24px; padding: 1px 4px; border: 0; font-size: .75rem; color: #514c8c; background: transparent; }
.calendar-hint { margin-top: 12px; font-size: .82rem; }
.time-grid-scroll { max-height: 65vh; overflow: auto; border: 1px solid #dfe3ed; border-radius: 12px; background: #fff; position: relative; }
.time-grid { display: grid; position: relative; }
.week-grid { grid-template-columns: 52px repeat(7, minmax(100px, 1fr)); min-width: 800px; }
.day-grid { grid-template-columns: 52px minmax(0, 1fr); }
.time-heading { position: sticky; top: 0; z-index: 1; padding: 12px 4px; text-align: center; background: #f7f8fc; border-bottom: 1px solid #dfe3ed; font-size: .8rem; font-weight: 650; }
.time-heading.is-today { background: #e7e4fa; color: #403a94; }
.hour-label { padding: 5px; text-align: right; color: #70758a; font-size: .72rem; border-bottom: 1px solid #eef0f4; }
.hour-cell { min-height: 58px; padding: 2px 4px; min-width: 0; border-left: 1px solid #e5e7ef; border-bottom: 1px solid #e5e7ef; }
#activity-dialog { width: min(94vw, 590px); padding: 22px; }
@media (max-width: 720px) {
  .month-day { min-height: 90px; padding: 3px 2px; }
  .calendar-event { font-size: .64rem; min-height: 21px; padding: 3px 2px; border-left-width: 2px; }
  .month-grid .event-time, .month-grid .event-title { display: block; overflow: hidden; text-overflow: ellipsis; }
  .month-grid .event-time { font-size: .6rem; margin: 0; }
  .day-number { min-height: 25px; width: 25px; font-size: .75rem; }
  .weekday { font-size: .7rem; }
  .calendar-toolbar { gap: 12px; }
  .calendar-toolbar h2 { font-size: 1.05rem; min-width: 140px; }
  .calendar-toolbar #date-selector { max-width: 155px; }
  .more-events { font-size: .63rem; }
  #activity-dialog { padding: 16px; }
}
fieldset { min-width: 0; border: 1px solid #dfe3ed; border-radius: 10px; padding: 12px; }
legend { font-weight: 650; }
.member-options { display: grid; gap: 8px; max-height: 210px; overflow-y: auto; margin-top: 10px; }
.member-option { display: flex; align-items: center; gap: 10px; min-height: 36px; font-weight: 500; }
.member-option input { width: 20px; min-height: 20px; margin: 0; flex-shrink: 0; accent-color: #45409a; }
