:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  --ink: #f7ede2;
  --muted: #c7b6ca;
  --gold: #e6c18a;
  --gold-ink: #261a23;
  --ground: #1c1524;
  --surface: #271d31;
  --raised: #34263e;
  --hover: #463252;
  --line: #54435e;
  --warning: #ffcb8a;
  --danger: #f6aabd;
  --display: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  background: var(--ground);
  color: var(--ink);
}
:root[data-theme=piano], .theme-choice[data-theme=piano] .theme-swatch {
  --ground: #171a21;
  --surface: #20252e;
  --raised: #2d3543;
  --hover: #3b4658;
  --line: #4c596e;
  --gold: #eee3ce;
  --ink: #f8f5ed;
  --muted: #c5cdd9;
}
:root[data-theme=strings], .theme-choice[data-theme=strings] .theme-swatch {
  --ground: #231613;
  --surface: #30201b;
  --raised: #3c2922;
  --hover: #53392c;
  --line: #654b3e;
  --gold: #f1bd96;
  --ink: #fff0e4;
  --muted: #dec1af;
}
:root[data-theme=custom], .theme-choice[data-theme=custom] .theme-swatch {
  --ground: color-mix(in srgb, #15131d 76%, var(--custom-background, #433353));
  --surface: color-mix(in srgb, #211d2a 71%, var(--custom-background, #433353));
  --raised: color-mix(in srgb, #2a2534 78%, var(--custom-background, #433353));
  --hover: color-mix(in srgb, #382e41 81%, var(--custom-background, #433353));
  --line: color-mix(in srgb, #655972 67%, var(--custom-background, #433353));
  --gold: color-mix(in srgb, #fff4df 82%, var(--custom-accent, #e6c18a));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  background: radial-gradient(ellipse at 85% 0%, var(--hover) 0%, transparent 44rem), var(--ground);
}
aside {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 28px 16px;
  background: linear-gradient(160deg, var(--surface), var(--ground) 72%);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font: 600 1.25rem/1.15 var(--display);
}
.seal {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line), var(--gold));
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--line);
  background: var(--hover);
  font-size: 1.15rem;
}
.menu { display: grid; gap: 5px; }
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}
.menu button span { width: 1.1rem; text-align: center; color: var(--gold); }
.menu button:hover { background: var(--raised); color: var(--ink); }
.menu button.active {
  background: linear-gradient(90deg, var(--hover), var(--raised));
  color: var(--ink);
  border-color: var(--line);
  box-shadow: inset 2px 0 var(--gold);
}
.sidebar-ornament {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: auto auto 12px;
  border: 1px solid var(--line);
  outline: 1px solid var(--raised);
  outline-offset: 6px;
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle, var(--raised), transparent 65%);
  font-size: 1.55rem;
}
main {
  width: 100%;
  max-width: 1680px;
  padding: 38px clamp(18px, 4vw, 60px);
}
.toolbar, .modal-head, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto clamp(205px, 23vw, 320px);
  grid-template-areas: "copy action art";
  align-items: center;
  gap: 16px;
  min-height: 130px;
  margin-bottom: 22px;
  padding: 24px clamp(16px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(102deg, var(--raised), var(--surface) 61%, var(--hover));
}
.header-copy { grid-area: copy; overflow-wrap: anywhere; }
header #add { grid-area: action; justify-self: start; }
.header-art {
  grid-area: art;
  position: relative;
  width: 100%;
  height: clamp(138px, 14vw, 190px);
  overflow: hidden;
}
.header-art::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: clamp(84px, 9vw, 116px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid #b5957670;
  border-radius: 50%;
  box-shadow: 0 0 0 10px #ae8d7133, 0 0 0 20px #ae8d7122;
  background: radial-gradient(circle, #9d788148, transparent 68%);
}
.header-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 24%, #f2cd97ad 0 1px, transparent 2px),
    radial-gradient(circle at 74% 28%, #f2cd9788 0 1px, transparent 2px),
    radial-gradient(circle at 66% 71%, #f2cd977f 0 1px, transparent 2px),
    radial-gradient(circle at 34% 78%, #f2cd9770 0 1px, transparent 2px);
}
@media (max-width: 960px) {
  header {
    grid-template-columns: minmax(0, 1fr) min(45%, 250px);
    grid-template-areas: "copy copy" "action art";
    gap: 8px 12px;
  }
  .header-art { height: clamp(88px, 17vw, 145px); }
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; }
h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); line-height: 1.08; }
h2 { color: var(--gold); font-size: 1.35rem; line-height: 1.2; }
h3 { margin-top: 18px; font-size: 1.2rem; }
#subtitle { color: var(--muted); margin-top: 8px; }
button, input, select, textarea { font: inherit; }
button {
  min-height: 42px;
  padding: 7px 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
}
button:hover { background: var(--hover); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.primary {
  background: linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 87%, var(--ground)));
  border-color: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
  white-space: nowrap;
}
.primary:hover { background: color-mix(in srgb, var(--gold) 80%, white); color: var(--gold-ink); }
section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 10px 28px #130e1a40;
}
.toolbar { padding: 15px 16px 9px; flex-wrap: wrap; }
.toolbar button { margin-right: 4px; }
#prev, #next { min-width: 42px; font-size: 1.25rem; line-height: 1; }
#count { padding: 0 16px 12px; color: var(--muted); font-size: .875rem; }
.views {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.views button {
  margin: 0;
  border-color: transparent;
  background: transparent;
  min-height: 35px;
  font-size: .875rem;
}
.views button:hover { background: var(--raised); }
.views button[aria-pressed=true] {
  background: var(--raised);
  border-color: var(--line);
  color: var(--gold);
  font-weight: 700;
}
.calendar-scroll { overflow-x: auto; }
.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.day { min-height: 385px; min-width: 0; padding: 8px; border-right: 1px solid var(--line); }
.day:last-child { border-right: 0; }
.day-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 7px;
  text-align: left;
  font-weight: 650;
  font-size: .875rem;
}
.day-head.current {
  background: var(--hover);
  border-color: color-mix(in srgb, var(--line), var(--gold));
  color: var(--gold);
}
.lesson {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  text-align: left;
  overflow-wrap: anywhere;
  background: var(--raised);
  border-left: 3px solid color-mix(in srgb, var(--gold), var(--line));
  font-size: .875rem;
}
.lesson strong, .lesson span { display: block; }
.lesson span { margin-top: 4px; color: var(--muted); }
.day-view { grid-template-columns: minmax(0, 1fr); }
.day-view .day { min-height: 240px; padding: 14px; }
.day-view .lesson { padding: 12px; }
.empty-day { padding: 16px 8px; color: var(--muted); }
.month-view { grid-template-columns: repeat(7, minmax(75px, 1fr)); min-width: 525px; }
.month-view .day { min-height: 103px; border-bottom: 1px solid var(--line); padding: 5px; }
.month-view .day:nth-child(7n) { border-right: 0; }
.month-view .weekday {
  padding: 8px;
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
}
.month-view .outside { background: var(--ground); }
.month-view .outside .day-head { color: var(--muted); }
.month-view .day-head { justify-content: center; min-height: 34px; padding: 4px; }
.month-view .lesson { padding: 5px; margin-top: 5px; }
.month-view .lesson span:nth-child(3) { display: none; }
.month-view .lesson span.lesson-warning { display: block; }
.foot { margin-top: 14px; color: var(--muted); font-size: .8125rem; }
dialog {
  width: min(470px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, var(--gold));
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px #0d0815a0;
}
dialog::backdrop { background: #100916b3; }
label { display: grid; gap: 6px; margin: 14px 0; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 9px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--muted));
  border-radius: 7px;
  background: var(--ground);
  color: var(--ink);
}
input:disabled { opacity: .58; }
textarea { resize: vertical; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.danger { color: var(--danger); margin-right: auto; }
#error { color: var(--danger); font-size: .875rem; }
#roster, .panel { padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel > p { margin-top: 6px; color: var(--muted); }
.student {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.student:last-child { border: 0; }
.student p { color: var(--muted); font-size: .875rem; margin-top: 3px; }
.student button { flex-shrink: 0; }
.section-title { margin-top: 20px; }
.profile-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; }
.profile-details dt { font-weight: 650; }
.profile-details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-list { margin: 8px 0 16px; padding-left: 22px; }
.profile-list li + li { margin-top: 6px; }
.profile-month { max-width: 240px; }
.hours-row {
  display: grid;
  grid-template-columns: minmax(115px, 1fr) repeat(2, minmax(105px, 140px));
  gap: 10px;
  align-items: center;
  max-width: 515px;
  border-bottom: 1px solid var(--line);
}
.hours-row:last-child { margin-bottom: 14px; }
.hours-row label { font-size: .875rem; margin: 8px 0; }
.check-label { display: flex; align-items: center; gap: 8px; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.status { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.status:empty { display: none; }
.warning, .day-warning, .lesson span.lesson-warning { color: var(--warning); }
.day-warning { font-size: .8125rem; margin: 5px 2px; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: 0 14px; }
.filters label { flex: 1; min-width: 155px; max-width: 280px; margin-top: 0; }
#paymentCount { margin-bottom: 10px; }
#paymentTable { width: 100%; border-collapse: collapse; text-align: left; }
#paymentTable th, #paymentTable td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
#paymentTable th { color: var(--gold); }
#paymentTable td small { display: block; color: var(--muted); }
#paymentTable tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 1050px) {
  body { grid-template-columns: 176px minmax(0, 1fr); }
  main { padding: 24px 16px; }
  .week-view { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .week-view .day { min-height: 170px; border-bottom: 1px solid var(--line); }
}
@media (max-width: 650px) {
  body { display: block; }
  aside { padding: 12px 14px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu { display: flex; flex-wrap: wrap; gap: 4px; }
  .menu button { padding-inline: 8px; }
  .sidebar-ornament { display: none; }
  main { padding: 16px 12px; }
  header { min-height: 0; }
  .week-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-view .day { min-height: 105px; }
  .toolbar h2 { order: 3; width: 100%; }
  .hours-row { grid-template-columns: minmax(85px, 1fr) repeat(2, minmax(0, 1fr)); gap: 6px; }
  .hours-row input[type=time] { padding: 6px 3px; }
  .panel, #roster { padding: 12px; }
}

#appearanceForm fieldset { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
#appearanceForm legend { padding: 0; font-weight: 600; }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 8px; margin-top: 8px; }
.theme-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 68px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.theme-choice:has(input:checked) { outline: 2px solid var(--gold); outline-offset: -2px; }
.theme-choice input { width: 18px; height: 18px; flex-shrink: 0; padding: 0; margin: 0; accent-color: var(--gold); }
.theme-choice small { display: block; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.theme-swatch {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  height: 34px;
  color: var(--gold);
  border: 1px solid var(--line);
  background: var(--ground);
  border-radius: 50%;
}
.colour-fields { display: flex; flex-wrap: wrap; gap: 0 14px; }
.colour-fields label { min-width: 140px; }
input[type=color] { min-height: 42px; padding: 4px; cursor: pointer; }
.settings-field { max-width: 285px; }
.instrument-list { list-style: none; padding: 0; margin: 8px 0 0; max-width: 520px; }
.instrument-list .student { padding: 7px 0; }
.theme-choice[data-theme=general] .theme-swatch { --ground: #1c1524; --gold: #e6c18a; --line: #54435e; }

:root[data-theme=piano], .theme-choice[data-theme=piano] { --theme-art: url("art/piano.png"); }
:root[data-theme=strings], .theme-choice[data-theme=strings] { --theme-art: url("art/strings.png"); }
:root[data-theme=general], .theme-choice[data-theme=general] { --theme-art: url("art/staff.png"); }

:root:is([data-theme=piano], [data-theme=strings], [data-theme=general]) .header-art::before {
  inset: 0;
  width: auto;
  aspect-ratio: auto;
  transform: none;
  border: 0;
  border-radius: 0;
  background: var(--gold);
  box-shadow: none;
  opacity: .76;
  mask: var(--theme-art) center / contain no-repeat;
}
:root:is([data-theme=piano], [data-theme=strings], [data-theme=general]) .header-art::after { display: none; }
.seal, .theme-swatch { position: relative; }
:root:is([data-theme=piano], [data-theme=strings], [data-theme=general]) .seal { color: transparent; }
:root:is([data-theme=piano], [data-theme=strings], [data-theme=general]) .seal::after,
.theme-choice:not([data-theme=custom]) .theme-swatch::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--gold);
  mask: var(--theme-art) center / contain no-repeat;
}
