:root {
  color-scheme: light;
  font-family: system-ui, "Malgun Gothic", sans-serif;
  color: #162338;
  background: #f4f6fa;
  line-height: 1.55;
  --ink: #162338;
  --muted: #4f6177;
  --line: #dce4ee;
  --surface: #fff;
  --accent: #145cc4;
  --accent-dark: #104ca5;
  --accent-soft: #e8f1fd;
  --shadow: 0 2px 4px #182e4a08, 0 12px 30px #182e4a08;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: .75rem clamp(1rem, 3vw, 2.5rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand strong { font-size: 1.125rem; letter-spacing: -.045em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
}
.brand-mark::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid white;
  border-radius: 3px;
  background: linear-gradient(white, white) center 4px / 100% 2px no-repeat;
}
.layout {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  min-height: calc(100vh - 66px);
}
aside {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  color: #eaf1fc;
  background: #142238;
}
nav, .account { display: grid; gap: .4rem; }
nav button, .account button {
  color: inherit;
  border-color: transparent;
  background: transparent;
}
nav button { text-align: left; min-height: 44px; padding-inline: .85rem; }
nav button:hover, .account button:hover { background: #243951; }
nav button[aria-current="page"] {
  background: #294669;
  box-shadow: inset 3px 0 #86bbff;
  color: #fff;
  font-weight: 700;
}
.account {
  border-top: 1px solid #3a4b63;
  margin-top: auto;
  padding-top: 1rem;
}
.account span { padding-inline: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.account button { border-color: #566983; }
main { min-width: 0; width: 100%; max-width: 1480px; margin-inline: auto; padding: clamp(1rem, 4vw, 3.5rem); }
aside[hidden] + main { grid-column: 1 / -1; }
#login {
  max-width: 440px;
  margin: clamp(1.5rem, 9vh, 6rem) auto 0;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
#login h1 { margin-bottom: 1.35rem; }
#login .primary { width: 100%; }
body:has(#login:not([hidden])) #status { max-width: 440px; margin-inline: auto; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.04em; }
h1 { font-size: clamp(1.8rem, 3.8vw, 2.65rem); margin-bottom: 1.3rem; }
h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h3 { font-size: 1.125rem; }
label { display: grid; gap: .35rem; margin-bottom: 1rem; font-size: .9375rem; font-weight: 650; }
input, select, textarea, button {
  min-width: 0;
  padding: .55rem .75rem;
  border: 1px solid #bac8da;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  background: var(--surface);
}
textarea { resize: vertical; }
button { min-height: 42px; cursor: pointer; font-weight: 600; }
button:hover { background: #eef3fa; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #3d89f0; outline-offset: 2px; }
.primary { color: #fff; border-color: var(--accent); background: var(--accent); font-weight: 700; }
.primary:hover { background: var(--accent-dark); }
.check { display: flex; align-items: center; gap: .5rem; }
input[type="checkbox"] { accent-color: var(--accent); }
.toolbar, .actions, .task-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-bottom: .9rem; }
.toolbar h2 { margin-bottom: 0; }
.actions { justify-content: flex-end; }
.actions:empty { display: none; }
#page > section + section { margin-top: 1.5rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: .9rem; }
.card, .calendar-panel, .minutes-list, .contacts-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card { padding: clamp(1rem, 2vw, 1.5rem); overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; }
.muted { color: var(--muted); }
.minutes-list { list-style: none; margin: 0; padding: 0; }
.minutes-list li + li { border-top: 1px solid var(--line); }
.minutes-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  padding: .9rem 1rem;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
  border-radius: 12px;
}
.minutes-link:hover, .minutes-link:focus-visible { background: var(--accent-soft); color: var(--accent-dark); }
.minutes-link time { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.schedule-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, max-content); gap: .35rem clamp(.5rem, 3vw, 2rem); }
.schedule-heading { padding: .75rem 1rem; background: #edf2f8; border-radius: 14px 14px 0 0; font-size: .875rem; }
.schedule-row time, .schedule-heading strong:not(:first-child) { min-width: 10ch; text-align: right; }
.minutes-back, .contacts-table a { color: var(--accent-dark); text-underline-offset: .18em; font-weight: 650; }
.minutes-back { display: inline-block; margin-bottom: .8rem; }
.minutes-detail h3 { font-size: 1.35rem; }
.contacts-table-wrap { overflow-x: auto; }
.contacts-table { width: 100%; border-collapse: collapse; text-align: left; }
.contacts-table th, .contacts-table td { padding: .75rem .9rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
.contacts-table th { background: #edf2f8; color: var(--muted); font-size: .875rem; }
.contacts-table tr:last-child td { border-bottom: 0; }
.contacts-table tbody tr:hover { background: #f3f7fd; }
.member-management { margin-bottom: 1.5rem; }
.member-management summary { cursor: pointer; padding: .55rem 0; }
.member-form { max-width: 480px; margin-bottom: .5rem; }
.member-feedback { overflow-wrap: anywhere; }
.calendar-panel { padding: clamp(.55rem, 2.5vw, 1.4rem); margin-bottom: 1.25rem; }
.calendar { display: grid; gap: 4px; }
.calendar-controls { display: flex; align-items: center; justify-content: space-between; gap: .35rem; margin-bottom: .75rem; }
.calendar-heading { font-size: clamp(1rem, 2.5vw, 1.5rem); letter-spacing: -.04em; }
.calendar-controls button { white-space: nowrap; }
.calendar-weekdays, .calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 4px; }
.calendar-week { min-height: 112px; row-gap: 3px; }
.weekday { padding-block: .3rem; color: var(--muted); text-align: center; font-size: .875rem; font-weight: 700; }
.day { display: flex; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: #f8faff; }
.day-number { width: 100%; line-height: 30px; text-align: left; padding-inline: .45rem; }
.day.today { background: #dcf1ff; border-color: #78b9e3; }
.weekday.sunday, .day.sunday .day-number, .day.holiday .day-number { color: #a52539; }
.holiday-label {
  display: inline-block;
  max-width: 48%;
  margin-inline-start: .2rem;
  vertical-align: bottom;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .75rem;
}
.day.today .holiday-label { display: none; }
.today-label { margin-inline-start: .3rem; color: #155083; font-size: .75rem; font-weight: 750; }
.calendar-event {
  z-index: 1;
  min-width: 0;
  min-height: 0;
  margin-inline: 2px;
  padding: 0 .4rem;
  border: 0;
  border-radius: 5px;
  color: #133b75;
  background: #dbeafa;
  font-size: .875rem;
  line-height: 24px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event:hover, .calendar-event[aria-pressed="true"] { background: var(--accent-dark); color: white; }
dialog { width: min(550px, calc(100% - 2rem)); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 16px; padding: 1.35rem; color: var(--ink); box-shadow: 0 20px 70px #13254140; }
dialog::backdrop { background: #142238a6; }
.minutes-editor textarea { min-height: clamp(220px, 42dvh, 520px); }
.minutes-editor .actions { margin-top: .75rem; }
.task-row { flex-wrap: nowrap; margin-bottom: .45rem; }
.task-row input[type="text"] { flex: 1; }
#status, #edit-error, .minutes-error { color: #a32439; margin-top: .75rem; }
#status:empty, #edit-error:empty, .minutes-error:empty { display: none; }
#menu { display: none; }
@media (max-width: 700px) {
  #menu { display: inline-block; }
  .layout { display: block; }
  aside { display: none; padding: .8rem 1rem 1rem; gap: .7rem; }
  aside.open { display: flex; }
  .account { margin-top: 0; }
  .calendar-week { min-height: 86px; }
  .calendar-weekdays, .calendar-week { column-gap: 2px; }
  .day-number { text-align: center; padding: 0; font-size: .875rem; }
  .today-label { margin-inline-start: .12rem; font-size: clamp(.57rem, 2vw, .75rem); }
  .holiday-label { font-size: .6rem; }
  .calendar-controls button { padding-inline: .45rem; font-size: .875rem; }
  .calendar-event { padding-inline: .2rem; margin-inline: 1px; font-size: .75rem; }
  .schedule-row { padding-inline: .6rem; gap: .35rem; }
}
