/* Move Orthopaedics design system (Brand Hub 2026 v1.0): Bebas Neue display, Barlow body, Barlow Condensed labels. Self-hosted. */
@font-face { font-family: "Bebas Neue"; font-weight: 400; font-display: swap; src: url(/fonts/BebasNeue-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(/fonts/Barlow-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/Barlow-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(/fonts/Barlow-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/Barlow-700.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(/fonts/BarlowCondensed-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/BarlowCondensed-600.woff2) format("woff2"); }
:root {
  /* Brand */
  --navy: #01033D; --navy-2: #081F7B; --dpurple: #442665; --lavender: #9279FC; --electric: #0436FD; --blush: #EEE1EA;
  /* Mapped onto the app's tokens */
  --purple: #01033D;          /* primary ground + primary buttons = Deep Navy */
  --purple-2: #081F7B;        /* hover = Navy Blue */
  --purple-soft: #EEE1EA;     /* Blush */
  --lilac: #9279FC;           /* Lavender: pointer only (rules, bullets, focus on navy) */
  --lilac-soft: #F7F4F8;      /* Off-white */
  --ink: #3A3550;             /* Text body */
  --ink-2: #6B6480;           /* Text mid */
  --line: rgba(68, 38, 101, .14);
  --bg: #F7F4F8;
  --card: #ffffff;
  --red: #b42318; --red-soft: #fdecea;
  --amber: #8a4b00; --amber-soft: #fff4e0;
  --green: #1b7a3d; --green-soft: #e6f4ea;
  --blue: #0436FD; --blue-soft: #e8edff;
  --r: 4px;
  --font: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --label: "Barlow Condensed", "Barlow", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--purple); }
h1, h2, h3 { color: var(--ink); margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.boot { padding: 40px; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* Buttons + inputs */
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--purple); background: var(--purple); color: #fff; border-radius: var(--r); padding: 8px 14px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { background: var(--purple-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost, .btn.ghost { background: #fff; color: var(--purple); }
button.ghost:hover { background: var(--purple-soft); }
button.link { background: none; border: none; color: var(--purple); padding: 0; font-weight: 600; }
button.danger { background: var(--red); border-color: var(--red); }
button.sm { padding: 4px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: #fff; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; min-height: 220px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.check input { width: auto; margin: 0; }

/* Shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--purple); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side .brand img { width: 44px; height: auto; background: #fff; border-radius: var(--r); padding: 4px; }
.side .brand span { font-weight: 700; line-height: 1.15; font-size: 14px; }
.nav a { display: block; color: #fff; text-decoration: none; padding: 9px 12px; border-radius: var(--r); font-weight: 600; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.nav a.on { background: #fff; color: var(--purple); opacity: 1; }
.side .foot { margin-top: auto; font-size: 12px; opacity: .7; padding: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top select { width: auto; min-width: 170px; }
.top .who { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 200px; padding: 6px; display: none; }
.menu.open { display: block; }
.menu button { display: block; width: 100%; text-align: left; background: none; color: var(--ink); border: none; padding: 8px 10px; font-weight: 500; }
.menu button:hover { background: var(--purple-soft); }
.menu .meta { padding: 8px 10px; font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.banner { background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid #f3d9a8; padding: 8px 24px; font-size: 13px; font-weight: 600; }
.banner.live { background: var(--green-soft); color: var(--green); border-color: #bfe3c9; }
.view { padding: 24px; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; }
.bottomnav { display: none; }

/* Cards, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card { margin-top: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stat { font-size: 32px; font-weight: 800; color: var(--purple); line-height: 1; }
.stat-label { color: var(--ink-2); font-size: 13px; font-weight: 600; text-transform: none; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.list li:first-child { border-top: none; }
.list a { text-decoration: none; font-weight: 600; }
.empty { color: var(--ink-2); padding: 20px; text-align: center; font-size: 14px; }
table.t { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); background: #faf9fb; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: none; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--lilac-soft); }
.t td.num { font-variant-numeric: tabular-nums; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eeedf1; color: var(--ink-2); white-space: nowrap; }
.chip.sent { background: var(--green-soft); color: var(--green); }
.chip.send { background: var(--amber-soft); color: var(--amber); }
.chip.wait { background: var(--blue-soft); color: var(--blue); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.pain-hi { color: var(--red); font-weight: 800; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; color: var(--ink-2); border: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 8px 12px; }
.tabs button.on { color: var(--purple); border-bottom-color: var(--purple); }
.tabs button:hover { background: var(--purple-soft); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.note { font-size: 12.5px; color: var(--ink-2); background: #faf9fb; border-left: 3px solid var(--lilac); padding: 6px 10px; border-radius: 0 var(--r) var(--r) 0; }
.summary { white-space: pre-wrap; background: #faf9fb; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; max-height: 320px; overflow: auto; font-size: 14px; }
.err { color: var(--red); font-weight: 600; }
iframe.preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
#plist, #llist, #aclist, #tlist, #sched, #calBody, .card { overflow-x: auto; }
.pains { display: flex; flex-wrap: wrap; gap: 6px; }
.pains .chip { font-weight: 600; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select, .inline-form input { width: auto; padding: 4px 6px; font-size: 13px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.cal .dow { background: #faf9fb; font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 8px; border-bottom: 1px solid var(--line); text-align: center; }
.cal .day { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; font-size: 12px; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: none; }
.cal .day.out { background: #fbfafc; color: #aaa; }
.cal .day.today .dn { background: var(--purple); color: #fff; border-radius: 999px; padding: 0 6px; }
.cal .dn { font-weight: 700; display: inline-block; margin-bottom: 3px; }
.ev { display: block; width: 100%; text-align: left; border: none; border-radius: 4px; padding: 2px 5px; margin-bottom: 2px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ev:hover { filter: brightness(.95); }
.ev.consult, .lg.consult { background: var(--blue-soft); color: var(--blue); }
.ev.surgery, .lg.surgery { background: var(--purple); color: #fff; }
.ev.preop, .lg.preop { background: var(--lilac-soft); color: var(--purple); }
.ev.postop, .lg.postop { background: var(--green-soft); color: var(--green); }
.ev.wound, .lg.wound { background: var(--amber-soft); color: var(--amber); }
.ev.followup, .lg.followup { background: #eeedf1; color: var(--ink); }
.more { font-size: 11px; color: var(--ink-2); background: none; border: none; padding: 0 4px; color: var(--purple); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; }
.lg { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }

/* Sign in */
.signin { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--purple) 0%, #2d1846 100%); padding: 16px; }
.signin form { background: #fff; border-radius: var(--r); padding: 28px; width: 100%; max-width: 380px; display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.signin img { width: 110px; margin: 0 auto 4px; display: block; }
.signin h1 { text-align: center; font-size: 20px; }

/* Dialog + toasts */
.dlg { border: none; border-radius: var(--r); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
.dlg::backdrop { background: rgba(30, 16, 46, .45); }
.dlg .dlg-body { padding: 20px; display: grid; gap: 12px; }
.dlg .dlg-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #faf9fb; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14px; max-width: 380px; }
.toast.bad { background: var(--red); }
.toast.good { background: var(--green); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--lilac); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 30px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; }

/* Mobile */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; }
  .side .brand { padding: 0; }
  .side .brand span, .side .nav, .side .foot { display: none; }
  .top { padding: 8px 12px; flex-wrap: wrap; }
  .top select { min-width: 0; flex: 1; }
  .view { padding: 14px 12px 90px; }
  .banner { padding: 8px 12px; }
  .g2, .g3, .g4, .split { grid-template-columns: 1fr; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--purple); z-index: 20; overflow-x: auto; }
  .bottomnav a { flex: 1 0 auto; color: #fff; text-decoration: none; font-size: 12px; font-weight: 700; padding: 12px 10px; text-align: center; opacity: .8; }
  .bottomnav a.on { opacity: 1; background: rgba(255,255,255,.15); }
  table.t, .t thead, .t tbody, .t tr, .t td { display: block; width: 100%; }
  .t thead { display: none; }
  .t tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .t td { border: none; padding: 3px 12px; }
  .t td[data-l]::before { content: attr(data-l) ": "; font-weight: 700; color: var(--ink-2); font-size: 12px; }
  .cal .day { min-height: 70px; }
  .ev { font-size: 10px; }
  iframe.preview { height: 420px; }
}


/* ---- Move design system layer ---- */
a, button.link { color: var(--dpurple); }
h1, h2, h3 { color: var(--navy); }
h1 { font-family: var(--display); font-weight: 400; font-size: 38px; letter-spacing: .01em; text-transform: uppercase; line-height: 1; }
h2 { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .02em; text-transform: uppercase; line-height: 1.05; }
h3 { font-family: var(--label); font-weight: 600; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--dpurple); }
.head { padding-bottom: 12px; border-bottom: 3px solid; border-image: linear-gradient(90deg, var(--lavender), var(--electric) 55%, rgba(4,54,253,0)) 1; margin-bottom: 20px; }
label, .stat-label, .t th, .cal .dow, .menu .meta { font-family: var(--label); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
label { font-size: 12.5px; color: var(--ink-2); }
.stat { font-family: var(--display); font-weight: 400; font-size: 52px; color: var(--navy); letter-spacing: .01em; }
.t th { background: var(--bg); color: var(--ink-2); font-size: 12.5px; }
.t tr.click:hover td { background: var(--blush); }
button, .btn { font-family: var(--label); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
button.ghost, .btn.ghost { border-color: var(--dpurple); color: var(--dpurple); }
button.primary, .btn.primary { background: var(--electric); border-color: var(--electric); }
.tabs button { font-family: var(--label); letter-spacing: .1em; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--lavender); }
.tabs button:hover { background: var(--blush); }
:focus-visible { outline: 2px solid var(--electric); }
input:focus, select:focus, textarea:focus { border-color: var(--electric); outline: none; box-shadow: 0 0 0 3px rgba(4,54,253,.12); }
.side { background: var(--navy); }
.side .brand span { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: .03em; text-transform: uppercase; }
.nav a { font-family: var(--label); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; font-size: 14px; border-left: 3px solid transparent; border-radius: 0 var(--r) var(--r) 0; }
.nav a:hover { background: var(--navy-2); }
.nav a.on { background: var(--navy-2); color: #fff; border-left-color: var(--lavender); }
.side .foot { font-family: var(--label); letter-spacing: .1em; text-transform: uppercase; }
.card { border-color: var(--line); box-shadow: 0 1px 0 rgba(1,3,61,.03); }
.note { background: var(--blush); border-left-color: var(--lavender); color: var(--ink); }
.summary { background: var(--bg); }
.chip { font-family: var(--label); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.chip.purple { background: var(--blush); color: var(--dpurple); }
.ev.surgery, .lg.surgery { background: var(--navy); color: #fff; }
.ev.consult, .lg.consult { background: var(--blue-soft); color: var(--electric); }
.ev.preop, .lg.preop { background: var(--blush); color: var(--dpurple); }
.cal .day.today .dn { background: var(--electric); }
.signin { background: radial-gradient(120% 90% at 85% 10%, var(--navy-2) 0%, var(--navy) 60%); }
.signin form { border-top: 4px solid; border-image: linear-gradient(90deg, var(--lavender), var(--electric)) 1; }
.signin h1 { font-size: 34px; }
.banner { font-family: var(--label); letter-spacing: .06em; font-size: 14px; }
.toast { background: var(--navy); }
.bottomnav { background: var(--navy); }
.bottomnav a { font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; }
.bottomnav a.on { background: var(--navy-2); box-shadow: inset 0 3px 0 var(--lavender); }
