:root {
  color-scheme: light;
  --ink: #182721;
  --muted: #52635a;
  --line: #dae4dc;
  --canvas: #f4f7f2;
  --paper: #fcfefa;
  --dark: #142a22;
  --dark-hover: #254034;
  --primary: #215f42;
  --primary-hover: #18482f;
  --mint: #e1f0e5;
  --gold: #ffe9bf;
  --gold-ink: #674913;
  --red: #8a351f;
  --red-bg: #faeee8;
  --corner: 14px;
  --control: 44px;
  --gutter: clamp(18px, 4vw, 54px);
  --body-font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display-font: Georgia, Cambria, serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--body-font); font-size: 15px; }
a { color: var(--primary); text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid #ae711d; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; transform: translateY(-200%); background: var(--paper); padding: 10px 15px; }
.skip-link:focus { transform: none; }

body[data-websocket] { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 29px 17px 22px;
  background: var(--dark);
  color: #f2f7f0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  font-weight: 720;
  letter-spacing: -.02em;
  line-height: 1.23;
}
.sidebar .brand { margin-inline: 8px; }
.brand small { display: block; color: #bfd2c5; margin-top: 3px; font-size: 12px; font-weight: 500; letter-spacing: 0; }
.brand-mark {
  flex: 0 0 37px;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 11px;
  color: #22583d;
  background: #d9edd9;
}
.brand-mark i { position: relative; width: 17px; height: 17px; }
.brand-mark i::before, .brand-mark i::after { position: absolute; background: currentColor; border-radius: 1px; content: ""; }
.brand-mark i::before { inset: 6px 0; }
.brand-mark i::after { inset: 0 6px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--control);
  padding: 8px 11px;
  color: #d7e5da;
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
}
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] { background: var(--dark-hover); color: #fff; }
.sidebar nav a[aria-current="page"] { box-shadow: inset 2px 0 #afdcae; }
.nav-icon { position: relative; width: 15px; height: 15px; flex: 0 0 15px; color: #afd0b8; }
.calendar-icon { border: 1.4px solid currentColor; border-radius: 3px; }
.calendar-icon::after { position: absolute; inset: 4px 0 auto; border-top: 1.4px solid currentColor; content: ""; }
.chat-icon { border: 1.4px solid currentColor; border-radius: 4px; }
.chat-icon::after { position: absolute; bottom: -3px; left: 3px; width: 4px; height: 4px; border-left: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: skew(-15deg, -28deg); content: ""; }
.form-icon { border: 1.4px solid currentColor; border-radius: 3px; }
.form-icon::after { position: absolute; inset: 4px 3px 3px; border-block: 1.4px solid currentColor; content: ""; }
.metrics-icon { border-bottom: 1.4px solid currentColor; }
.metrics-icon::after { position: absolute; bottom: 2px; left: 1px; width: 3px; height: 6px; background: currentColor; box-shadow: 5px -2px currentColor, 10px -4px currentColor; content: ""; }
.connection-icon { border: 1.4px solid currentColor; border-radius: 50%; }
.connection-icon::after { position: absolute; inset: 4px; border-radius: 50%; background: currentColor; content: ""; }
.settings-icon { border: 2px dotted currentColor; border-radius: 100%; }
.settings-icon::after { position: absolute; inset: 3px; border: 1.4px solid currentColor; border-radius: 100%; content: ""; }
.nav-count { min-width: 23px; margin-left: auto; padding: 2px 5px; border-radius: 10px; background: #d6edd6; color: var(--dark); text-align: center; font-size: 12px; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding-top: 17px; border-top: 1px solid #375247; }
.profile { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 9px; min-width: 0; }
.profile strong, .profile small { display: block; overflow-wrap: anywhere; }
.profile small { margin-top: 1px; color: #bfd2c5; }
.profile-initial { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #3b5649; color: white; font-weight: 700; }
.logout { min-height: var(--control); padding: 5px 0; color: #e0ede1; background: transparent; border: 0; cursor: pointer; text-align: left; }
.logout:hover { text-decoration: underline; }

.workspace { min-width: 0; width: 100%; max-width: 1620px; margin-inline: auto; padding: 0 var(--gutter) 48px; }
.workspace-header { min-height: 64px; display: flex; align-items: center; gap: 14px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.workspace-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.workspace-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.availability-pill {
  position: relative;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: #28543a;
  font-size: 12px;
  font-weight: 680;
}
.availability-pill.is-outside { background: #e8ede8; color: #48534c; }
.availability-pill::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.availability-pill [role="tooltip"] {
  display: none;
  position: absolute;
  z-index: 1;
  top: calc(100% + 3px);
  right: 0;
  max-width: 235px;
  width: max-content;
  padding: 7px 11px;
  color: #fff;
  background: var(--dark);
  border-radius: 6px;
  font-weight: 500;
}
.availability-pill:hover [role="tooltip"], .availability-pill:focus [role="tooltip"] { display: block; }
.connection:empty { display: none; }
.connection { color: var(--muted); font-size: 12px; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-block: clamp(25px, 5vw, 49px) 24px; }
h1, h2, p { margin: 0; }
h1 { font: 500 clamp(37px, 5vw, 57px)/.99 var(--display-font); letter-spacing: -.048em; }
h2 { font: 500 26px/1.12 var(--display-font); letter-spacing: -.025em; }
.page-title p { margin-top: 9px; color: var(--muted); }
.page-title .button { flex-shrink: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--corner); }
.plus { font-size: 22px; line-height: .8; font-weight: 400; }
.button, .icon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: var(--control);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
  line-height: 1.2;
}
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary, .icon-button { border-color: var(--line); color: var(--ink); background: var(--paper); }
.button.secondary:hover, .icon-button:hover { border-color: #b5c8b7; background: var(--canvas); }
.button.danger { border-color: #e8c9bd; background: var(--red-bg); color: var(--red); }
.button[disabled] { cursor: not-allowed; opacity: .55; }
.icon-button { width: var(--control); padding: 2px; font-size: 25px; font-weight: 400; }
.alerts { display: grid; gap: 6px; margin-top: 12px; }
.alert { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.alert.success { background: var(--mint); }
.alert.error, .form-errors { color: var(--red); background: var(--red-bg); }
.form-errors { border-radius: 6px; padding: 6px 10px; }
.form-errors ul { margin: 0; padding-left: 19px; }

.overview { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 21px; border: 1px solid var(--line); border-radius: var(--corner); background: var(--paper); }
.overview-cell { display: grid; grid-template-columns: 11px minmax(0, 1fr); align-items: start; gap: 10px; padding: 17px clamp(11px, 2.4vw, 24px); }
.overview-cell + .overview-cell { border-left: 1px solid var(--line); }
.overview-cell span:not(.metric-mark) { display: block; color: var(--muted); font-size: 13px; }
.overview-cell strong { display: block; margin-top: 2px; font-size: 25px; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.overview-cell strong.metric-status { margin-top: 6px; font-size: 15px; letter-spacing: 0; }
.metric-mark { width: 9px; height: 9px; border-radius: 100%; margin-top: 5px; background: #91ab9a; }
.metric-mark.free { border: 1.5px solid #488757; background: transparent; }
.metric-mark.booked { background: #488757; }
.metric-mark.attention { background: #9d6b28; }
.schedule-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: end; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.date-nav { display: flex; gap: 5px; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.filters label, .cancel-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 680; }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea { min-width: 0; width: 100%; min-height: var(--control); padding: 8px 10px; border: 1px solid #bccdbf; border-radius: 7px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
.period + .period { border-top: 1px solid var(--line); }
.period > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 18px; }
.period > header span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.agenda-table { width: 100%; border-collapse: collapse; text-align: left; }
.agenda-table th, .agenda-table td { padding: 11px 18px; vertical-align: middle; }
.agenda-table th { background: var(--canvas); font-size: 12px; color: var(--muted); font-weight: 700; }
.agenda-table td { border-top: 1px solid #e6ede6; }
.slot-hour { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot-hour span { color: var(--muted); font-size: 12px; font-weight: 500; }
.status-tag { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #ebf0ec; color: #48544e; white-space: nowrap; font-size: 12px; font-weight: 680; }
.status-tag.confirmed { background: var(--mint); color: #26563a; }
.status-tag.open { box-shadow: inset 0 0 0 1px #b8d7bf; background: #f4faf3; color: #315f42; }
.status-tag.cancelled { background: var(--red-bg); color: var(--red); }
.status-tag.attention { background: var(--gold); color: var(--gold-ink); }
.table-detail, .table-detail small { display: block; }
.table-detail { margin-top: 4px; }
.table-detail small, small.table-detail { color: var(--muted); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions a { display: inline-flex; align-items: center; gap: 4px; min-height: var(--control); font-weight: 650; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
.empty-state { padding: 16px 18px 21px; color: var(--muted); }
.cancelled-list { padding: 13px 18px; border-top: 1px solid var(--line); }
.cancelled-list summary { width: fit-content; min-height: var(--control); align-content: center; cursor: pointer; font-weight: 650; }
.cancelled-list li + li { margin-top: 6px; }
.cancelled-list a { margin-left: 5px; }
.admin-control { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; padding: 18px; }
.admin-control p, .field-note { margin-top: 5px; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; min-height: var(--control); margin-top: 15px; text-decoration: none; font-weight: 640; }
.back-link + .page-title { margin-top: 11px; }
.appointment-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin: 0 0 16px; padding: 18px; }
.appointment-summary dd { margin: 4px 0 0; font-weight: 650; }
.appointment-summary dt, .form-field label { color: var(--muted); font-size: 13px; font-weight: 680; }
.form-card { max-width: 820px; margin-bottom: 15px; padding: 18px; }
.slot-filter { margin-top: 14px; }
.booking-form { display: grid; justify-items: start; gap: 14px; margin-top: 18px; }
.form-fields { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
.form-field { display: grid; align-items: start; gap: 4px; }
.form-check { grid-column: 1 / -1; }
.form-check label { display: flex; align-items: center; gap: 5px; min-height: var(--control); }
.cancel-form { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cancel-form label { flex: 1 1 245px; }

.inbox { display: grid; grid-template-columns: minmax(232px, .34fr) minmax(0, 1fr); min-height: 475px; }
.inbox-list { border-right: 1px solid var(--line); }
.inbox-list ul { margin: 0; padding: 0; list-style: none; }
.tabs { display: flex; flex-wrap: wrap; column-gap: 8px; padding-inline: 11px; border-bottom: 1px solid var(--line); }
.tabs a { display: flex; align-items: center; min-height: var(--control); padding-inline: 5px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 680; }
.tabs a[aria-current="page"] { border-bottom-color: var(--primary); color: var(--primary); }
.chat-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 62px; padding: 8px 11px; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.chat-row strong { overflow-wrap: anywhere; font-size: 13px; }
.chat-row small { display: block; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; }
.chat-row time { align-self: start; margin-top: 5px; color: var(--muted); font-size: 11px; }
.chat-row:hover, .chat-row[aria-current="page"] { background: var(--mint); }
.chat-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #dcebe0; color: var(--primary); font-size: 12px; font-weight: 750; }
.inbox-detail { display: flex; flex-direction: column; min-width: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.chat-header h2 { font: 700 17px var(--body-font); overflow-wrap: anywhere; }
.chat-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.chat-log { display: flex; flex-direction: column; align-items: start; gap: 9px; flex: 1 1 320px; max-height: 58vh; max-height: 58dvh; overflow-y: auto; padding: 16px; background: #f0f5ef; }
.bubble { max-width: min(90%, 540px); padding: 9px 12px; border-radius: 3px 10px 10px; background: #fff; border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble.outgoing { align-self: end; border-radius: 10px 3px 10px 10px; background: var(--mint); }
.bubble div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 11px; }
.bubble p { margin-top: 4px; white-space: pre-wrap; }
.bubble .status-tag { margin-top: 5px; }
.compose, .reassign { display: flex; gap: 8px; align-items: end; padding: 11px 14px; border-top: 1px solid var(--line); }
.compose label { flex: 1; }
.compose textarea { display: block; }
.chat-window { flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.close-attention { flex-wrap: wrap; }
.close-attention label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 680; }
.chat-empty { min-height: 300px; display: grid; place-content: center; gap: 8px; text-align: center; padding: 24px; }
.chat-empty p { color: var(--muted); }
.empty-icon { position: relative; justify-self: center; display: block; width: 25px; height: 25px; color: #4d8263; }
.affiliation-tabs { padding-inline: 14px; }
.affiliation-actions form, .affiliation-actions a { display: inline-flex; }
.affiliation-actions { white-space: nowrap; }
.metrics-table { min-width: 840px; }
.metrics-table tbody th { background: var(--paper); border-top: 1px solid #e6ede6; color: var(--ink); font-size: 14px; }
.metrics-table td { font-variant-numeric: tabular-nums; }
.metrics-note { margin-top: 9px; color: var(--muted); font-size: 13px; }
.connection-card-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 12px; }
.connection-link { margin-top: 12px; }
.connection-form .form-field { width: min(100%, 570px); }
.bridge-qr { display: grid; gap: 10px; margin-top: 13px; color: var(--muted); }
.bridge-qr img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.connection-reset { margin-top: 9px; }
.connection-reset summary { width: fit-content; min-height: var(--control); align-content: center; color: var(--primary); cursor: pointer; font-weight: 650; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 62% 36%, #42684f, #152c22 67%); }
.login-box { width: min(100%, 425px); padding: clamp(24px, 6vw, 42px); background: var(--paper); border-radius: var(--corner); }
.login-brand small { color: var(--muted); }
.login-box h1 { margin: 28px 0 17px; font-size: clamp(35px, 6vw, 42px); }
.login-box form { display: grid; gap: 5px; }
.login-box label { margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 680; }
.login-box .button { margin-top: 9px; }

@media (max-width: 1010px) {
  body[data-websocket] { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .schedule-toolbar { justify-content: initial; }
}
@media (max-width: 740px) {
  body[data-websocket] { display: block; }
  .sidebar { position: static; height: auto; gap: 10px; padding: 12px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 3px; }
  .sidebar nav a { padding-inline: 8px; font-size: 13px; gap: 5px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 2px; border-top: 0; }
  .profile-initial { width: 30px; height: 30px; }
  .profile { grid-template-columns: 30px minmax(0, 1fr); font-size: 12px; }
  .logout { font-size: 12px; }
}
@media (max-width: 560px) {
  .workspace-header { min-height: 48px; flex-wrap: wrap; gap: 4px 6px; }
  .workspace-label { margin-right: auto; }
  .workspace-status { margin-left: 0; }
  .page-title { align-items: start; flex-direction: column; gap: 9px; margin-block: 24px 14px; }
  .overview { margin-bottom: 12px; }
  .overview-cell { gap: 3px; padding: 11px 6px; }
  .overview-cell strong { font-size: 19px; }
  .overview-cell strong.metric-status { font-size: 12px; }
  .overview-cell span:not(.metric-mark) { font-size: 11px; }
  .schedule-toolbar { padding: 10px; gap: 8px; }
  .period > header { padding: 12px 10px; }
  .agenda-table th, .agenda-table td { padding: 8px 7px; font-size: 13px; }
  .slot-hour span { display: block; }
  .table-detail { line-height: 1.2; }
  .admin-control { flex-direction: column; align-items: start; }
  .form-fields { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; min-height: auto; }
  .inbox-list { border-right: 0; }
  .inbox-list ul { max-height: 205px; overflow: auto; }
  .chat-log { max-height: 45vh; max-height: 45dvh; }
  .chat-header { align-items: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .icon-button, .sidebar nav a { transition: background-color 150ms, border-color 150ms; }
}

