:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #292535;
  background: #f8f8fb;
  font-synthesis: none;
  --ink: #292535;
  --muted: #6e6978;
  --border: #e3e0e9;
  --purple: #7750cb;
  --purple-dark: #5f36ab;
  --lavender: #f1ebfc;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { background: none; border: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #aa8bdf; outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .65; }
.skip { position: fixed; top: -100px; left: 10px; z-index: 4; background: white; color: var(--purple); padding: 10px; }
.skip:focus { top: 5px; }
.app-header { position: relative; z-index: 1; min-height: 64px; display: flex; align-items: center; padding: 0 28px; gap: 30px; background: white; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; flex: none; gap: 8px; color: #292333; font-size: 24px; font-weight: 740; letter-spacing: -.065em; }
.brand i { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #7951cf; color: white; font: italic 700 23px/1 Georgia, serif; padding-bottom: 5px; }
.app-nav,.header-end,.actions,.name-line,.account-toggle,.account-card,.record-title,.dialog-foot,.text-link,.back { display: flex; align-items: center; }
.app-nav { gap: 4px; min-width: 0; }
.nav-item { display: inline-flex; gap: 7px; align-items: center; padding: 8px 12px; border-radius: 6px; white-space: nowrap; color: #514b58; font-weight: 550; font-size: 13px; }
.nav-item svg { color: #736b7e; }
.nav-item.active,.icon-button.active { color: var(--purple-dark); background: var(--lavender); }
.nav-item.active svg { color: var(--purple); }
.nav-item:hover,.account-toggle:hover,.icon-button:hover { background: #f4f1f8; }
.header-end { gap: 3px; margin-left: auto; flex: none; }
.header-divider { height: 23px; border-right: 1px solid var(--border); margin: 0 8px; }
.account-toggle { gap: 7px; border-radius: 20px; padding: 3px 6px 3px 3px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; flex: none; place-items: center; background: #e9e0f9; color: #65449a; font-size: 11px; font-weight: 700; }
.avatar.large,.page-heading .patient-avatar { width: 47px; height: 47px; font-size: 16px; }
.hue-1 { background: #dfeceb; color: #39756c; }
.hue-2 { background: #e3eaf7; color: #466788; }
.hue-3 { background: #f8e9db; color: #8a5f37; }
.hue-4 { background: #f4e1eb; color: #8a5270; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none; border-radius: 6px; color: #655e6f; padding: 0; }
svg { flex: none; }
.button { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 7px; min-height: 35px; border: 1px solid #d9d4e0; background: white; border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 550; line-height: 20px; white-space: nowrap; }
.button:hover { border-color: #b7a9cd; background: #faf8fd; }
.button.primary { color: white; background: var(--purple); border-color: var(--purple); }
.button.primary:hover { background: var(--purple-dark); border-color: var(--purple-dark); }
.button svg { width: 16px; height: 16px; }
main { outline: none; }
.app-page { max-width: 1880px; margin: 0 auto; padding: 27px 28px 22px; }
.page-heading,.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading { margin: 0 0 22px; min-height: 55px; }
h1,h2,h3,h4,p,dl { margin: 0; }
h1 { font-size: clamp(26px,2.4vw,34px); font-weight: 650; line-height: 1.19; letter-spacing: -.048em; }
h2 { font-size: 19px; letter-spacing: -.03em; font-weight: 650; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 640; letter-spacing: -.02em; }
h4 { font-size: 13px; font-weight: 650; }
.page-heading p,.muted,.record-subtitle,.account-card p,.integration p,.upcoming p { color: var(--muted); }
.page-heading p { margin-top: 4px; font-size: 13px; }
.actions { flex-wrap: wrap; gap: 8px; }
.select-control { display: inline-flex; align-items: center; gap: 6px; position: relative; border: 1px solid #d9d4e0; background: white; border-radius: 6px; min-height: 35px; padding: 0 10px; color: #50495a; }
.select-control > svg { pointer-events: none; }
.select-control > svg:first-child:not(:last-child) { position: absolute; left: 10px; }
.select-control > svg:last-child { position: absolute; right: 8px; }
.select-control select { color: inherit; appearance: none; -webkit-appearance: none; border: none; border-radius: inherit; outline-offset: 1px; margin: 0 -10px; padding: 7px 28px 7px 10px; background: transparent; font-size: 12px; font-weight: 540; max-width: 200px; min-height: 33px; }
.select-control svg + select { padding-left: 32px; }
.loading,.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.loading p { margin: 10px 0 18px; }
.empty svg { color: #937cbb; margin-bottom: 9px; }
.empty h3 { color: #50485c; }
.empty p { font-size: 13px; margin-top: 4px; }
.record-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; min-width: 0; overflow: hidden; }
.table-tools,.panel-heading { padding: 17px 20px; }
.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.panel-heading { border-bottom: 1px solid var(--border); }
.search { display: inline-flex; align-items: center; gap: 8px; height: 36px; width: min(310px,100%); background: #fff; border: 1px solid #d9d4e0; border-radius: 6px; padding: 0 10px; color: #8b8593; }
.search:focus-within { outline: 2px solid #bba5e4; }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 13px; color: var(--ink); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-size: 12px; font-weight: 580; color: #6c6675; background: #f8f7fa; border-top: 1px solid #eeeaf2; }
th,td { padding: 12px 19px; }
td { border-top: 1px solid #eeeaf2; font-size: 13px; overflow-wrap: anywhere; }
td .text-link { white-space: normal; }
tr:hover td { background: #fdfcfe; }
.name-line,.account-card { gap: 10px; }
.name-line strong { font-weight: 610; }
.text-link,.back,.list-link { color: var(--purple-dark); padding: 0; font-size: inherit; font-weight: 550; text-align: left; }
.text-link:hover,.list-link:hover,.back:hover { text-decoration: underline; }
.row-arrow { display: inline-grid; place-items: center; color: #756b82; width: 27px; height: 27px; border-radius: 5px; }
.row-arrow:hover { background: var(--lavender); }
.badge { border-radius: 99px; display: inline-flex; align-items: center; padding: 3px 9px; font-size: 11px; line-height: 17px; font-weight: 610; white-space: nowrap; color: #706779; background: #efedf2; }
.status-booked,.status-issued,.status-pending { color: #654997; background: #eee7fa; }
.status-completed,.status-paid,.status-sent,.status-final { color: #34705a; background: #e0f1e9; }
.status-failed,.status-cancelled,.status-void { color: #934f52; background: #f7e7e7; }
.back { width: fit-content; gap: 3px; font-size: 13px; margin: 0 0 14px; }
.record-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin: 0 0 20px; overflow-x: auto; }
.record-tabs a { display: block; padding: 10px 1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 550; white-space: nowrap; }
.record-tabs a.active { color: var(--purple-dark); border-color: var(--purple); }
.overview-grid,.settings-grid { display: grid; grid-template-columns: minmax(270px,.9fr) minmax(310px,1.2fr); gap: 18px; }
.summary-panel { padding: 23px; }
.summary-panel h2 { margin-bottom: 19px; }
.info-row { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; border-bottom: 1px solid #eeeaf2; padding: 10px 0; font-size: 13px; }
.info-row:last-child { border: none; }
.info-row dt { color: var(--muted); flex: none; }
.info-row dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.upcoming { display: flex; gap: 11px; align-items: center; margin: 14px 0 20px; }
.upcoming .button { margin-left: auto; }
.upcoming p,.integration p { font-size: 13px; margin-top: 3px; }
.summary-panel > p + .button { margin-top: 15px; }
.date-tile { display: grid; place-items: center; background: #f1ecfa; color: #6d4b9f; border-radius: 7px; min-width: 48px; padding: 4px 8px; }
.date-tile small { text-transform: uppercase; font-size: 10px; font-weight: 640; }
.date-tile b { font-size: 19px; line-height: 1.1; }
.integration { display: flex; align-items: center; gap: 12px; padding: 18px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.integration > div { flex: 1 1 140px; }
.integration-icon { width: 40px; height: 40px; flex: none; border-radius: 9px; background: #f1edf9; color: #7252a9; display: grid; place-items: center; }
.integration h3 { font-size: 14px; }
dialog { border: 1px solid #e7e1ed; background: white; color: var(--ink); padding: 0; border-radius: 12px; width: min(440px,calc(100% - 24px)); max-height: 90dvh; box-shadow: 0 20px 100px #20133334; }
dialog.wide { width: min(535px,calc(100% - 24px)); }
dialog::backdrop { background: #21182e50; }
.dialog-head,.dialog-foot { gap: 10px; padding: 14px 21px; background: white; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.dialog-head .icon-button { margin-right: -5px; }
.dialog-body { padding: 21px; }
.dialog-foot { justify-content: flex-end; border-top: 1px solid var(--border); flex-wrap: wrap; }
.records-title,.record-title { gap: 12px; justify-content: space-between; }
.record-title h3 { font-size: 21px; overflow-wrap: anywhere; }
.record-title + dl,.account-card + dl { margin-top: 14px; }
.record-subtitle { margin-top: 4px; }
.detail-list { display: grid; gap: 15px; margin: 24px 0; }
.detail-line { display: flex; gap: 12px; align-items: center; }
.detail-line > svg { color: #82778d; }
.detail-line small,.detail-line span { display: block; }
.detail-line small { font-size: 11px; color: var(--muted); }
.appointment-links { display: flex; flex-wrap: wrap; gap: 7px; }
.related { margin-top: 19px; }
.list-link { display: flex; align-items: center; gap: 7px; padding: 6px 0; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 15px; margin: 12px 0 0; background: #f8f6fb; border-radius: 6px; }
.fields { display: grid; gap: 15px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 590; color: #4d4558; }
.field input,.field textarea,.field select { display: block; width: 100%; min-width: 0; border: 1px solid #d9d4df; border-radius: 6px; background: #fff; padding: 8px 10px; min-height: 39px; font-size: 14px; }
.field input:disabled,.field select:disabled { background: #f6f4f8; color: #66606f; opacity: 1; cursor: default; }
.field textarea { resize: vertical; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: -9px; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-field input { width: 16px; height: 16px; accent-color: var(--purple); }
.form-error { color: #9b3842; font-size: 13px; border-radius: 5px; padding: 8px 10px; background: #fff0f1; }
#toast { position: fixed; z-index: 5; bottom: 20px; left: 50%; transform: translate(-50%,6px); opacity: 0; background: #31283d; color: #fff; border-radius: 7px; padding: 9px 16px; font-size: 13px; box-shadow: 0 3px 15px #20132924; pointer-events: none; transition: opacity .15s, transform .15s; max-width: 90vw; }
#toast.visible { opacity: 1; transform: translate(-50%,0); }
@media (max-width: 1000px) {
  .app-header { padding: 0 18px; gap: 18px; }
  .nav-item { padding: 8px 9px; gap: 5px; }
  .app-page { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 760px) {
  .app-header { flex-wrap: wrap; gap: 0; padding: 10px 15px 0; }
  .brand { font-size: 22px; }
  .brand i { width: 29px; height: 29px; }
  .header-end { margin-left: auto; }
  .app-nav { order: 3; width: calc(100% + 30px); max-width: calc(100vw - 10px); overflow-x: auto; padding: 9px 0 8px; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .nav-item { font-size: 12px; }
  .overview-grid,.settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .app-nav { justify-content: space-between; }
  .nav-item { padding: 7px 8px; }
  .nav-item svg { display: none; }
  .app-page { padding: 19px 12px; }
  .page-heading { align-items: center; gap: 10px; margin-bottom: 15px; }
  .page-heading .button { font-size: 12px; padding: 5px 9px; }
  .page-heading .actions { justify-content: flex-end; }
  .panel-heading { align-items: flex-start; flex-wrap: wrap; }
  .table-tools,.panel-heading { padding: 12px; }
  .search { flex: 1 1 140px; }
  .summary-panel { padding: 16px; }
  .record-tabs { gap: 16px; }
  .table-wrap { overflow: visible; }
  table,tbody,tr,td { display: block; }
  thead { position: absolute; clip: rect(0,0,0,0); clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  tr { padding: 11px 13px; border-top: 1px solid var(--border); }
  td { display: flex; align-items: center; justify-content: space-between; padding: 3px 0; font-size: 12px; text-align: right; gap: 10px; border: none; }
  td:first-child { font-size: 14px; font-weight: 600; text-align: left; padding-bottom: 6px; }
  td:not(:first-child)::before { content: attr(data-label); font-weight: 400; color: var(--muted); }
  td:has(.row-arrow) { display: none; }
  .dialog-foot,.dialog-head { padding: 12px 16px; }
  .dialog-body { padding: 16px; }
  .field-pair { grid-template-columns: 1fr; }
  .field input,.field textarea,.field select { font-size: 16px; }
}
@media print {
  body:has(dialog[open]) { background: #fff; }
  body:has(dialog[open]) > :not(dialog) { display: none !important; }
  dialog[open] { display: block; position: static; width: 100%; max-width: none; max-height: none; overflow: visible; inset: auto; border: none; box-shadow: none; margin: 0; }
  dialog::backdrop { background: transparent; }
  .dialog-foot,.dialog-head .icon-button { display: none; }
}
.settings-links { margin-top: 15px; }
@media (max-width: 470px) {
  .page-heading:has(.name-line) { flex-wrap: wrap; align-items: flex-start; }
  .page-heading:has(.name-line) .actions { justify-content: flex-start; }
}
