:root {
  color-scheme: light;
  --canvas: #f3f6f7;
  --surface: #fff;
  --ink: #182b36;
  --muted: #506471;
  --soft: #627784;
  --line: #dce5e8;
  --teal: #0c645b;
  --teal-deep: #06483f;
  --mint: #e6f4ee;
  --danger: #a12928;
  --warning: #75490c;
  --radius: 18px;
  --shadow: 0 2px 6px #173a4107;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 3.8vw, 3rem); font-weight: 720; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .58; }
a { color: var(--teal); text-underline-offset: .17em; }
:focus-visible { outline: 3px solid #188176; outline-offset: 3px; }
[hidden] { display: none !important; }
svg { flex: none; vertical-align: middle; }
[tabindex="-1"]:focus { outline: none; }
.skip-link { position: fixed; top: .7rem; left: .7rem; z-index: 20; transform: translateY(-200%); background: white; padding: .7rem; }
.skip-link:focus { transform: none; }
.boot { min-height: 80dvh; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--muted); }
.boot img, .brand img { border-radius: 12px; display: block; }

.site-header { border-bottom: 1px solid var(--line); background: #fff; padding-top: env(safe-area-inset-top); }
.header-inner { max-width: 1220px; margin: auto; padding: 17px 32px; display: flex; gap: 24px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 740; line-height: 1.14; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 3px; font-size: .73rem; font-weight: 530; color: var(--soft); letter-spacing: 0; }
.nav { display: flex; gap: 3px; }
.nav button { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); background: transparent; padding: 9px 13px; font-size: .88rem; font-weight: 660; border: 0; border-radius: 10px; white-space: nowrap; min-height: 44px; }
.nav button[aria-current="page"] { color: var(--teal-deep); background: var(--mint); }
.nav button:hover:not([aria-current]) { background: var(--canvas); }
.header-account { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: transparent; min-width: 0; padding: 5px 7px; color: var(--ink); font-size: .85rem; font-weight: 650; }
.header-account span:not(.avatar) { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; flex: none; place-items: center; border-radius: 50%; width: 38px; height: 38px; color: #18433e; background: #dcefeb; font-weight: 750; line-height: 1; }
.avatar[data-tone="iris"] { color: #463279; background: #eee8ff; }
.avatar[data-tone="ocean"] { color: #263d75; background: #e5edfc; }
.avatar[data-tone="rose"] { color: #792d49; background: #f9e6ef; }
.avatar[data-tone="honey"] { color: #634315; background: #f7edd1; }
.avatar[data-tone="sky"] { color: #194f65; background: #e1f1f8; }
.avatar[data-tone="forest"] { color: #315a46; background: #dbecdf; }
.avatar[data-tone="plum"] { color: #654680; background: #f0e5f6; }

.page { width: min(100%, 1220px); margin-inline: auto; padding: 36px 32px max(56px, env(safe-area-inset-bottom)); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading p { color: var(--muted); margin-top: 7px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 290px); align-items: start; gap: 22px; }
.layout > *, .cards > * { min-width: 0; }
.stack { display: grid; align-content: start; gap: 16px; }
.narrow { max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: clamp(17px, 3vw, 25px); }
.card-title { display: flex; gap: 12px; align-items: center; margin-bottom: 15px; }
.card-title > div { min-width: 0; }
.card-title p, .muted { color: var(--muted); }
.card-title p { font-size: .9rem; margin-top: 5px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 15px; flex-wrap: wrap; }
.section-head p { font-size: .88rem; color: var(--muted); }
.category-icon { width: 38px; height: 38px; flex: none; border-radius: 11px; display: inline-grid; place-items: center; background: var(--mint); color: var(--teal); }
.category-icon[data-category="doctor"] { background: #fbe9ed; color: #a63c59; }
.category-icon[data-category="class"] { background: #efeafb; color: #6449a0; }
.category-icon[data-category="other"] { background: #faf0dc; color: #7a5415; }

.btn { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; border: 1px solid var(--line); padding: 8px 14px; border-radius: 11px; color: var(--ink); font-weight: 660; text-align: center; background: #fff; text-decoration: none; }
.btn:hover:not(:disabled) { background: #f5f9fa; }
.btn.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.btn.primary:hover:not(:disabled) { background: var(--teal-deep); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.icon-only { padding: 8px; width: 44px; }
.btn.icon-only svg { width: 19px; height: 19px; }
.btn.sm { font-size: .88rem; }
.btn.full { width: 100%; }
.text-link { background: none; border: 0; color: var(--teal); min-height: 44px; font-weight: 660; padding: 0; text-align: left; }
.text-link:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; }
.split { display: flex; flex-wrap: wrap; gap: 9px; justify-content: space-between; align-items: center; }

.calendar-card { overflow: clip; }
.calendar-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 18px 22px 15px; }
.calendar-nav { display: flex; gap: 6px; align-items: center; }
.calendar-nav strong { padding-inline: 5px; font-size: 1.07rem; letter-spacing: -.02em; }
.switch { display: inline-flex; gap: 2px; padding: 3px; background: #eef3f4; border: 1px solid #e8edef; border-radius: 11px; }
.switch button { border: 0; border-radius: 8px; min-height: 38px; padding-inline: 13px; font-size: .87rem; font-weight: 660; background: transparent; color: var(--muted); }
.switch button[aria-pressed="true"] { background: white; color: var(--ink); box-shadow: 0 1px 5px #253c4017; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 0 20px 17px; }
.day-choice { background: #f6f8f8; border: 1px solid transparent; border-radius: 12px; padding: 8px 2px 6px; display: grid; justify-items: center; min-width: 0; color: var(--muted); min-height: 72px; line-height: 1.2; }
.day-choice:hover { border-color: #9fbfb8; }
.day-choice small { font-size: .70rem; font-weight: 650; text-transform: uppercase; }
.day-choice strong { font-size: 1.16rem; color: var(--ink); }
.day-choice.is-today:not([aria-pressed="true"]) { border-color: #a5cabf; color: var(--teal); }
.day-choice[aria-pressed="true"] { background: var(--teal); color: #eaf9f4; }
.day-choice[aria-pressed="true"] strong { color: #fff; }
.day-dot { border-radius: 50%; background: currentColor; width: 4px; height: 4px; margin-top: 3px; }
.day-dot.empty { visibility: hidden; }
.date-picker { position: relative; }
.date-picker input { padding: 7px 9px; width: auto; min-height: 44px; color: var(--muted); }
.calendar-content { border-top: 1px solid var(--line); padding: 21px 22px 24px; min-height: 280px; }
.calendar-section + .calendar-section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.event-list { display: grid; gap: 8px; margin-top: 12px; }
.event-row { display: grid; grid-template-columns: 61px minmax(0, 1fr); align-items: stretch; gap: 11px; }
.event-time { font-variant-numeric: tabular-nums; align-self: start; display: grid; padding-top: 9px; line-height: 1.3; }
.event-time small { color: var(--soft); font-size: .81rem; }
.event-tile { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: start; text-align: left; width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; padding: 10px; }
.event-tile:hover { border-color: #91bfb4; background: #fcfefe; }
.event-tile > svg { align-self: center; color: var(--soft); }
.event-tile strong { display: block; line-height: 1.3; overflow-wrap: anywhere; }
.event-meta { display: flex; gap: 4px 11px; flex-wrap: wrap; align-items: center; margin-top: 4px; color: var(--muted); font-size: .81rem; }
.event-meta span, .detail-line { display: inline-flex; gap: 5px; align-items: flex-start; overflow-wrap: anywhere; min-width: 0; }
.event-meta svg { margin-top: 2px; }
.event-meta .depart { color: var(--teal-deep); font-weight: 680; }
.attention { color: var(--warning); font-weight: 650; }
.empty-day { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 31px 12px 16px; color: var(--muted); }
.empty-day strong { color: var(--ink); font-size: 1.02rem; }
.empty-day .category-icon { margin-bottom: 2px; width: 51px; height: 51px; border-radius: 16px; }
.quiet { color: var(--muted); font-size: .9rem; margin-top: 10px; }
.filter-list { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); padding: 5px 9px; overflow-wrap: anywhere; min-height: 39px; font-size: .87rem; font-weight: 640; }
.filter[aria-pressed="true"] { background: var(--mint); border-color: #b6d6cc; color: var(--teal-deep); }
.filter .avatar { width: 20px; height: 20px; font-size: .64rem; }
.mobile-filter { display: none; }
.upcoming { background: #e9f4f0; border-color: #d4e7e0; color: var(--teal-deep); }
.upcoming-title { display: grid; gap: 5px; margin: 10px 0 3px; overflow-wrap: anywhere; }
.upcoming .category-icon { background: #d6ebe3; }
.upcoming .card-title { margin-bottom: 9px; }
.upcoming .text-link { display: inline-flex; gap: 7px; align-items: center; }
.upcoming p { color: #38625c; font-size: .9rem; }

form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: block; min-width: 0; }
.field > span, legend { display: block; font-size: .87rem; color: var(--ink); font-weight: 680; margin-bottom: 5px; }
.field small, .form-help { display: block; color: var(--muted); font-size: .82rem; margin-top: 5px; }
input, select, textarea { max-width: 100%; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #c6d3d8; background: #fff; border-radius: 10px; color: var(--ink); font-size: 1rem; }
textarea { min-height: 82px; resize: vertical; }
select { padding-right: 22px; }
input[type="date"], input[type="time"] { min-width: 0; appearance: none; text-align: start; }
input[type="checkbox"], input[type="radio"] { width: 19px; height: 19px; padding: 0; min-height: 0; margin: 0; flex: none; accent-color: var(--teal); }
input[type="color"] { min-height: 44px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.checks { display: flex; gap: 6px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line); font-size: .88rem; overflow-wrap: anywhere; }
.check:has(input:checked) { background: var(--mint); border-color: #b4d8cb; color: var(--teal-deep); }
.check.plain { border: 0; padding-inline: 0; background: none; }
.check .avatar { width: 23px; height: 23px; font-size: .7rem; }
.field-error { color: var(--danger); display: block; margin-top: 4px; font-size: .86rem; }
.callout { background: #eff5f5; color: var(--ink); border: 1px solid #d5e5e3; border-radius: 11px; padding: 11px 12px; font-size: .91rem; overflow-wrap: anywhere; }
.callout p + p { margin-top: 6px; }
.callout.warning { background: #fff7e6; border-color: #f0d7a4; color: #63410c; }
.callout.error { background: #fff1f1; border-color: #efcaca; color: var(--danger); }
.callout.success { background: #e9f5ed; border-color: #cbe0d2; color: var(--teal-deep); }
.callout ul { padding-inline-start: 20px; margin: 8px 0; }
.form-message:empty { display: none; }
.form-message .actions { margin-top: 8px; }
.method-list { display: grid; gap: 8px; margin: 0; padding-inline-start: 21px; color: var(--muted); }
.results { display: grid; gap: 9px; }
.slot { text-align: left; width: 100%; justify-content: space-between; padding-inline: 12px; font-weight: 620; }
.slot small { color: var(--muted); display: block; }
.person-list { display: grid; }
.person-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; padding-block: 11px; border-top: 1px solid var(--line); }
.person-name { display: flex; gap: 9px; align-items: center; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.person-name small { display: block; color: var(--muted); font-weight: 500; }
.nap-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.nap-list { display: grid; gap: 8px; }

dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; background: white; color: var(--ink); width: min(600px, calc(100% - 24px)); max-height: min(87dvh, 900px); box-shadow: 0 20px 75px #0e282450; overflow: auto; overscroll-behavior: contain; margin: auto; }
dialog::backdrop { background: #14263080; }
.dialog-head { padding: 16px 21px 13px; display: flex; gap: 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-body { padding: 18px 21px 21px; }
.dialog-body > .stack { gap: 13px; }
body:has(dialog[open]) { overflow: hidden; }
.detail-line svg { margin-top: 3px; color: var(--teal); }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 9; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); width: fit-content; max-width: calc(100% - 40px); border-radius: 11px; padding: 11px 14px; background: #173c38; color: white; box-shadow: 0 8px 24px #132f3033; }
.toast:empty { display: none; }

.auth-layout { margin-inline: auto; max-width: 1180px; min-height: calc(100dvh - 82px); display: grid; grid-template-columns: minmax(0, 1.17fr) minmax(0, 1fr); align-items: center; gap: 36px; padding: 38px clamp(18px, 5vw, 63px) 55px; }
.auth-form { max-width: 410px; width: 100%; justify-self: center; }
.auth-form h1 { font-size: clamp(1.95rem, 3vw, 2.65rem); margin-bottom: 9px; }
.auth-form > p { margin: 0 0 20px; color: var(--muted); }
.auth-form .callout { margin-bottom: 14px; }
.auth-form .form-message .callout { margin-bottom: 0; }
.auth-art { min-height: 485px; background: radial-gradient(ellipse at 75% 23%, #24776b, transparent 56%), linear-gradient(147deg,#104e4e,#142d39); color: #fff; border-radius: 24px; padding: clamp(22px, 4vw, 44px); display: grid; align-content: start; gap: 26px; overflow: hidden; position: relative; }
.auth-art h2 { max-width: 390px; color: #fff; font-size: clamp(1.9rem, 4vw, 3.4rem); letter-spacing: -.045em; }
.auth-art p { margin-top: 13px; color: #d3ebe6; max-width: 310px; }
.art-calendar { width: min(355px, 100%); background: #f7fbfa; color: #1d383d; border-radius: 17px; padding: 15px; box-shadow: 0 18px 54px #09282d77; transform: rotate(-5deg) translate(12px, 11px); }
.art-title { display: flex; align-items: center; gap: 9px; font-weight: 720; margin-bottom: 11px; }
.art-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.art-week span { display: grid; justify-items: center; background: #edf5f2; color: #375858; line-height: 1; border-radius: 7px; padding: 7px 3px; gap: 5px; font-size: .66rem; }
.art-week span:nth-child(3) { background: #12685d; color: white; }
.art-week strong { font-size: .91rem; }
.art-line { display: flex; align-items: center; gap: 7px; height: 26px; margin-top: 8px; }
.art-line i { height: 8px; border-radius: 5px; width: 73%; background: #dbeae7; }
.art-line + .art-line i { width: 52%; background: #ebe8f4; }
.auth-link { margin-top: 14px; display: inline-block; }

@media (max-width: 900px) {
  .header-inner { gap: 10px; padding-inline: 21px; }
  .header-account span:not(.avatar) { display: none; }
  .page { padding-inline: 21px; }
}
@media (max-width: 730px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .calendar-side { display: none; }
  .mobile-filter { display: block; padding: 0 13px 12px; }
  .mobile-filter summary { color: var(--muted); font-weight: 640; cursor: pointer; font-size: .88rem; padding: 8px 2px; }
  .mobile-filter .filter-list { padding: 2px 0 4px; }
  .header-inner { padding: 11px 15px; }
  .nav { position: fixed; inset: auto 0 0; z-index: 5; justify-content: space-around; background: #fff; border-top: 1px solid var(--line); padding: 5px max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); }
  .nav button { flex: 1; justify-content: center; gap: 3px; flex-direction: column; padding: 5px 1px; min-height: 48px; font-size: .67rem; white-space: normal; }
  .nav button svg { width: 20px; height: 20px; }
  .header-account { justify-content: center; min-width: 44px; min-height: 44px; }
  .page { padding: 23px 13px calc(81px + env(safe-area-inset-bottom)); }
  .page-heading { align-items: flex-end; margin-bottom: 17px; }
  .page-heading p { font-size: .84rem; margin-top: 4px; }
  .page-heading .btn { flex: none; font-size: .85rem; padding-inline: 9px; }
  .calendar-bar { padding: 12px 12px 11px; }
  .calendar-nav { gap: 4px; }
  .calendar-nav strong { font-size: .96rem; padding-inline: 3px; }
  .week-strip { padding: 0 11px 7px; gap: 4px; }
  .day-choice { min-height: 63px; border-radius: 9px; }
  .calendar-content { padding: 14px 13px 20px; }
  .event-row { gap: 6px; grid-template-columns: 44px minmax(0, 1fr); }
  .event-tile { grid-template-columns: 32px minmax(0, 1fr); gap: 7px; padding: 8px; }
  .event-tile .category-icon { width: 32px; height: 32px; border-radius: 9px; }
  .event-tile > svg { display: none; }
  .event-time { font-size: .88rem; }
  .event-time small { font-size: .76rem; }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); right: 12px; }
  .auth-layout { min-height: 0; grid-template-columns: 1fr; gap: 17px; padding-top: 18px; max-width: 500px; }
  .auth-art { min-height: 0; gap: 10px; max-height: 210px; padding: 20px; }
  .auth-art h2 { font-size: 1.84rem; }
  .auth-art p { margin-top: 6px; font-size: .86rem; }
  .art-calendar { transform: rotate(-5deg) translate(20px, 7px); max-width: 285px; }
  .auth-form { width: 100%; max-width: none; }
  .dialog-head, .dialog-body { padding-inline: 15px; }
  dialog { max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); }
}
@media (max-width: 370px) {
  .calendar-bar { gap: 6px; }
  .calendar-nav strong { font-size: .89rem; }
  .switch button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.color-choice .avatar { border: 1px solid currentColor; }
.onboarding-head { margin-bottom: 14px; }
.onboarding-head .card-title { margin-bottom: 0; }
.invite-warning { margin-bottom: 15px; }
.invite-warning .actions { margin-top: 6px; }
.account-email { overflow-wrap: anywhere; }
#slot-results { margin-top: 13px; }
.busy-status { color: var(--muted); font-size: .9rem; }
