:root {
  --cream: #FFEEC7;
  --maroon: #7A0000;
  --maroon-dark: #660000;
  --text: #2b1600;
  --text-muted: #6b5a40;
  --border: #e8d6a3;
  --surface: #ffffff;
  --danger: #b3261e;
  --success: #2e6b3e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
}

a { color: var(--maroon); }

/* ---- Header: brand on the left; + quick add, tabs and search grouped in the
   middle; messages and account on the right. ---- */
.topbar {
  background: var(--maroon-dark);
  color: var(--cream);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  column-gap: 1rem;
  padding: 0 1rem;
  min-height: 62px;
  position: relative;
  z-index: 50;
}
.topbar .brand {
  justify-self: start; align-self: center;
  display: flex; flex-direction: column; justify-content: center;
  color: var(--cream); text-decoration: none; line-height: 1.15;
  white-space: nowrap;
}
.brand-sub { font-size: 0.72rem; opacity: 0.85; letter-spacing: 0.02em; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: 0.02em; }
.topbar .ic { flex: none; }
.hd-center { display: flex; align-items: stretch; gap: 0.8rem; }
.hd-right { justify-self: end; display: flex; align-items: center; gap: 0.9rem; }

/* Pop-up menus built on <details>: open by click or tap, no hover needed */
.hd-pop { position: relative; align-self: center; }
.hd-pop > summary { list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hd-pop > summary::-webkit-details-marker { display: none; }
.hd-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 210px;
  background: #fff; color: var(--text); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(60, 0, 0, 0.25); padding: 0.35rem 0; z-index: 60;
}
.hd-menu-right { left: auto; right: 0; }
.hd-menu a, .hd-menu button {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; box-sizing: border-box; min-height: 44px;
  padding: 0.5rem 0.95rem; color: var(--text); text-decoration: none; font-size: 1rem;
  background: none; border: 0; text-align: left; cursor: pointer; font-family: inherit;
}
.hd-menu a:hover, .hd-menu button:hover { background: var(--cream); color: var(--maroon-dark); }
.hd-menu .ic { color: var(--maroon); }
.hd-menu-head { padding: 0.4rem 0.95rem 0.5rem; font-size: 0.85rem; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 0.25rem; }

.quick-add-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 238, 199, 0.16); color: var(--cream);
  border: 2px solid rgba(255, 238, 199, 0.55);
  transition: background 0.15s;
}
.quick-add-btn:hover, .quick-add[open] .quick-add-btn { background: var(--cream); color: var(--maroon-dark); }

/* Tabs: an icon over a label, each with its own accent stripe on top. The
   open section's tab turns cream and its pages show in the strip below. */
.hd-tabs { display: flex; align-items: stretch; gap: 3px; margin: 0; padding-top: 8px; }
.hd-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 88px; padding: 6px 10px 7px; box-sizing: border-box;
  color: var(--cream); text-decoration: none; font-size: 0.86rem; font-weight: 500;
  background: rgba(255, 238, 199, 0.09);
  border-top: 4px solid var(--accent);
  border-radius: 3px 3px 0 0;
  transition: background 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.hd-tab:hover, .hd-tab:focus-visible { background: rgba(255, 238, 199, 0.2); }
.hd-tab.active { background: var(--cream); color: var(--maroon-dark); font-weight: 700; }
.hd-tab.active .ic { color: var(--accent); }

.search-pill {
  align-self: center;
  display: flex; align-items: center; gap: 0.45rem;
  background: #fff; color: var(--text-muted); border: 0; border-radius: 999px;
  padding: 0.55rem 1.4rem 0.55rem 0.9rem; font-size: 0.95rem; cursor: pointer; font-family: inherit;
  min-width: 140px;
}
.search-pill .ic { color: var(--maroon); }
.search-pill:hover { box-shadow: 0 0 0 3px rgba(255, 238, 199, 0.45); }
.hd-icon { position: relative; color: var(--cream); display: flex; padding: 8px; }
.hd-icon:hover { color: #fff; }
.hd-badge {
  position: absolute; top: -2px; right: -4px; background: #d93025; color: #fff;
  font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; line-height: 1.4;
}
.hd-history-menu { width: 340px; max-height: 70vh; overflow-y: auto; }
.hd-history-menu a { display: block; line-height: 1.25; }
.hd-history-menu .hh-title { display: block; color: var(--text); }
.hd-history-menu .hh-sub { display: block; font-size: 0.8rem; color: var(--text-muted); }
.hd-history-empty { padding: 0.6rem 0.95rem; color: var(--text-muted); font-size: 0.9rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--cream); color: var(--maroon-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
}

/* The open section's own pages, in a strip under the header */
.subnav {
  display: flex; align-items: stretch; flex-wrap: wrap; gap: 0.2rem;
  background: #fff8e6; border-bottom: 3px solid var(--accent);
  padding: 0 1rem; font-size: 0.92rem;
}
.subnav-title {
  display: flex; align-items: center; gap: 0.35rem; font-weight: 700; color: var(--maroon-dark);
  padding: 0.45rem 0.9rem 0.45rem 0; margin-right: 0.4rem; border-right: 1px solid var(--border);
}
.subnav-title .ic { color: var(--accent); }
.subnav a {
  display: flex; align-items: center; padding: 0.45rem 0.8rem; color: var(--text); text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.subnav a:hover { color: var(--maroon); background: var(--cream); }
.subnav a.active { font-weight: 700; color: var(--maroon-dark); border-bottom-color: var(--maroon-dark); }

/* Narrower screens: smaller tabs, then icons only (the open tab's name
   shows at the start of the strip below). Phones: brand, +, search,
   messages and account on the first row; the eight tabs fill the second. */
@media (max-width: 1360px) {
  .brand-sub { display: none; }
  .hd-tab { min-width: 66px; font-size: 0.78rem; padding: 6px 7px 7px; }
  .search-pill { min-width: 0; padding-right: 0.9rem; }
}
@media (max-width: 1080px) {
  .tab-label { display: none; }
  .hd-tab { min-width: 48px; }
  .search-pill span { display: none; }
  .search-pill { padding: 0.6rem; }
}
@media (max-width: 700px) {
  .topbar {
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas: "brand add search right" "tabs tabs tabs tabs";
    column-gap: 0.6rem; padding: 6px 0.6rem 0;
  }
  .hd-center { display: contents; }
  .topbar .brand { grid-area: brand; padding: 0.55rem 0; }
  .quick-add { grid-area: add; }
  .search-pill { grid-area: search; }
  .hd-right { grid-area: right; gap: 0.4rem; }
  .hd-tabs { grid-area: tabs; padding-top: 4px; gap: 2px; }
  .hd-tab { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 6px 2px; }
  .hd-menu { position: fixed; top: 104px; left: 0.6rem; right: auto; width: calc(100vw - 1.2rem); min-width: 0; box-sizing: border-box; }
  .quick-add-btn, .avatar { width: 38px; height: 38px; }
  .search-pill { padding: 0.5rem; }
  .subnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; padding: 0 0.6rem; }
  .subnav a { padding: 0.65rem 0.75rem; }
  /* iPhone zooms the page into any box with text under 16px; keep them at 16 */
  input, select, textarea { font-size: 16px; }
}

/* Section landing pages (Administration, Reports) */
.nav-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.8rem; }
.nav-tile {
  display: block; background: #fff; border-radius: 8px; padding: 1rem 1.1rem; font-weight: 600;
  color: var(--maroon-dark); text-decoration: none; border-left: 5px solid var(--accent);
  box-shadow: 0 1px 3px rgba(60, 0, 0, 0.12);
}
.nav-tile:hover { background: #fff8e6; }

/* Global search (header) */
.gs-overlay[hidden] { display: none; }
.gs-overlay {
  position: fixed; inset: 0; background: rgba(40, 10, 0, 0.35); z-index: 100;
  display: flex; justify-content: center; align-items: flex-start; padding-top: 4vh;
}
.gs-box {
  background: #fff; width: min(820px, 94vw); max-height: 86vh; border-radius: 10px;
  box-shadow: 0 18px 50px rgba(40, 0, 0, 0.35); display: flex; flex-direction: column; overflow: hidden;
}
.gs-input-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.gs-input-row input {
  flex: 1; border: 0; outline: 0; font-size: 1.1rem; padding: 0.35rem 0; background: transparent;
  color: var(--text); font-family: inherit; -webkit-appearance: none; appearance: none;
}
.gs-input-row input::-webkit-search-cancel-button { display: none; }
.gs-close { background: none; border: 0; cursor: pointer; color: var(--text); padding: 4px; display: flex; }
.gs-results { overflow-y: auto; padding: 0.6rem 0 1rem; min-height: 280px; }
.gs-results h3 { font-size: 1.05rem; margin: 0.6rem 1.6rem 0.4rem; color: var(--text); }
.gs-results a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.42rem 1.6rem; color: var(--text); text-decoration: none;
}
.gs-results a .ic { color: var(--maroon-dark); }
.gs-results a.sel, .gs-results a:hover { background: var(--cream); }
.gs-num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gs-sub { color: var(--text-muted); font-size: 0.86rem; margin-left: auto; padding-left: 1rem; text-align: right; }
.gs-results a.gs-more { color: var(--maroon); font-size: 0.88rem; font-weight: 600; padding-left: 2.6rem; }
.gs-empty { padding: 0.8rem 1.6rem; color: var(--text-muted); }
.gs-foot {
  display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 1rem;
  border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-muted); background: #fffaf0;
}
@media (max-width: 700px) {  /* phones: search fills the screen */
  .gs-overlay { padding-top: 0; }
  .gs-box { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .gs-results { flex: 1; }
  .gs-foot { display: none; }
  .gs-sub { display: none; }
  .gs-results a { padding: 0.7rem 1rem; }
  .gs-results h3 { margin-left: 1rem; }
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  color: var(--maroon-dark);
  margin: 0;
  font-size: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--maroon);
}

.stat .label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

th {
  background: var(--maroon);
  color: var(--cream);
  font-weight: 600;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #fff8ea; }

.btn {
  display: inline-block;
  background: var(--maroon);
  color: var(--cream);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn:hover { background: var(--maroon-dark); }

.btn-secondary {
  background: transparent;
  color: var(--maroon-dark);
  border: 1px solid var(--maroon-dark);
}

.btn-secondary:hover { background: #fff3da; }

.btn-danger {
  background: var(--danger);
}

form .field {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: var(--maroon-dark);
}

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fffdf7;
}

/* Tick boxes and round buttons keep their own size. The 100% width above
   squashed them to nothing inside table cells in Safari, so they could not
   be seen or ticked (count list builder, 2026-11-12). */
input[type=checkbox], input[type=radio] { width: auto; padding: 0; flex: none; }

textarea { min-height: 80px; resize: vertical; }

.form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-scheduled { background: #fde9c8; color: var(--maroon-dark); }
.badge-checked_in { background: #d8e9ff; color: #1a4a8a; }
.badge-completed { background: #d9f0dd; color: var(--success); }
.badge-cancelled { background: #f3d6d4; color: var(--danger); }

.badge-overdue { background: #f3d6d4; color: var(--danger); }
.badge-due-soon { background: #ffe8b8; color: #8a5a00; }
.badge-upcoming { background: #d9f0dd; color: var(--success); }
.badge-standing { background: #eee7d6; color: var(--text-muted); }

.whiteboard-scroll { overflow-x: auto; }

.whiteboard-grid { min-width: 900px; }

.whiteboard-grid th, .whiteboard-grid td {
  text-align: center;
  white-space: nowrap;
}

.whiteboard-grid th.wb-patient,
.whiteboard-grid td.wb-patient { text-align: left; white-space: normal; }

.wb-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.wb-done { background: #d9f0dd; color: var(--success); }
.wb-pending { background: #d8e9ff; color: #1a4a8a; }
.wb-missed { background: #f3d6d4; color: var(--danger); }
.wb-due { background: #ffe8b8; color: #8a5a00; }

.flash {
  background: #fff3da;
  border: 1px solid var(--border);
  border-left: 4px solid var(--maroon);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
}

.subtle {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell a, .actions-cell button {
  font-size: 0.85rem;
  margin-right: 0.5rem;
}

/* --- Scheduler (calendar day view) --------------------------------------- */
.container-wide { max-width: none; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.section-title { color: var(--maroon-dark); font-size: 1.1rem; margin-top: 1.5rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .field { flex: 1 1 180px; }
.badge-unconfirmed { background: #fde9c8; color: var(--maroon-dark); }
.badge-confirmed { background: #d9f0dd; color: var(--success); }
.badge-lmom_to_confirm { background: #ffe8b8; color: #8a5a00; }

.cal-header { flex-wrap: wrap; gap: 0.6rem; }
.cal-nav { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.cal-jump input { width: auto; margin: 0; }

/* Fixed-height slot above the grid: the bar appears in it without moving
   anything. Bars are laid over the slot (absolute), so even a bar that
   wraps on a narrow screen covers the top of the grid instead of
   pushing it down. */
.cal-bar-slot { position: relative; height: 2.75rem; margin-bottom: 0.6rem; }
.cal-bar-hint {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 0.8rem; border: 2px dashed var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 0.9rem;
}
.cal-toolbar, .paste-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20; min-height: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
  background: var(--surface); border: 2px solid var(--maroon); border-radius: 8px;
  padding: 0.3rem 0.8rem; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.cal-toolbar { z-index: 21; }
/* Narrower screens: the buttons drop to a second (or third) line, so
   reserve that much room up front instead. */
@media (max-width: 1200px) { .cal-bar-slot { height: 5rem; } }
@media (max-width: 640px) { .cal-bar-slot { height: 7.75rem; } }
.cal-toolbar[hidden], .paste-banner[hidden] { display: none; }
#cal-toolbar-text { flex: 1 1 12rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-toolbar-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.paste-banner { background: #fff3da; justify-content: flex-start; }

.cal-scroll { overflow: auto; max-height: calc(100vh - 215px); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.cal {
  display: grid;
  grid-template-columns: 56px repeat(var(--cal-cols), minmax(170px, 1fr));
  grid-template-rows: auto var(--cal-height);
  min-width: max-content;
}
.cal-head {
  position: sticky; top: 0; z-index: 5;
  background: #f6e7c4; color: var(--maroon-dark); font-weight: 700; font-size: 0.85rem;
  padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
}
.cal-timehead { left: 0; z-index: 6; border-left: none; }
.cal-credit { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }
.cal-head-cancel { background: #eee; color: #555; }
.cal-times { position: sticky; left: 0; z-index: 4; background: #fffaf0; border-right: 1px solid var(--border); }
.cal-hour { position: absolute; right: 6px; font-size: 0.75rem; color: var(--text-muted); transform: translateY(2px); }
.cal-col { position: relative; border-left: 1px solid var(--border); }
.cal-col-cancel { background: repeating-linear-gradient(45deg, #fafafa, #fafafa 8px, #f2f2f2 8px, #f2f2f2 16px); }
.cal-hourline { position: absolute; left: 0; right: 0; border-top: 1px solid #ddd; }
.cal-slot {
  position: absolute; left: 0; right: 0; display: block;
  border-top: 1px solid #efe3c4; text-decoration: none;
}
.cal-slot:hover { background: #fff3da; }
.cal-pasting .cal-slot:hover { background: #d8e9ff; outline: 2px dashed #1a4a8a; outline-offset: -2px; cursor: copy; }

.cal-card {
  position: absolute; z-index: 2; overflow: hidden; cursor: pointer;
  background: var(--card-bg); color: var(--card-fg);
  border-radius: 4px; border: 1px solid rgba(0,0,0,0.25);
  padding: 1px 5px; font-size: 0.74rem; line-height: 1.15;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.cal-card:hover { z-index: 3; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.cal-card.selected { z-index: 4; outline: 3px solid #1a4a8a; outline-offset: 1px; }
.cal-card.cancelled { background: #e9e9e9; color: #444; border-style: dashed; }
.cal-card.cancelled strong { text-decoration: line-through; }
.cal-card.cancelled::before { content: "CANCELLED "; font-weight: 700; font-size: 0.68rem; color: var(--danger); }
.cal-sub { opacity: 0.9; }
.cal-icon { font-weight: 700; margin-right: 2px; font-size: 0.72rem; }
.cal-pill { display: inline-block; background: #fff; color: var(--maroon-dark); border-radius: 8px; padding: 0 5px; font-size: 0.66rem; font-weight: 700; margin-right: 3px; }
.cal-booker { opacity: 0.85; font-style: italic; }

.cal-dialog { border: none; border-radius: 10px; padding: 1.2rem 1.4rem; width: min(440px, 92vw); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.cal-dialog::backdrop { background: rgba(0,0,0,0.35); }
.cal-dialog h2 { margin-top: 0; color: var(--maroon-dark); font-size: 1.15rem; }
.cancel-note { border-left: 4px solid var(--danger); }

.settings-table input, .settings-table select { margin: 0; }
.settings-table .num-input { width: 5.5rem; }
.settings-table input[type="color"] { width: 3rem; height: 2rem; padding: 0; }
[hidden] { display: none !important; }
.cal-card.cancelled.rescheduled::before { content: "RESCHEDULED "; color: #1a4a8a; }
.col-picker { position: relative; }
.col-picker summary { list-style: none; cursor: pointer; }
.col-picker summary::-webkit-details-marker { display: none; }
.col-picker-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 230px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18); padding: 0.6rem 0.8rem;
}
.col-picker-menu label { display: flex; gap: 0.45rem; align-items: center; font-weight: 400; color: var(--text); margin: 0.25rem 0; }
.col-picker-menu input { width: auto; margin: 0; }
.col-picker-menu .btn { margin-top: 0.4rem; }
.cal-head-rules { background: #f6e7c4; }
.cal-col-rules { background: #fafafa; }
.cal-rule {
  position: absolute; left: 0; right: 0; overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.8); padding: 2px 6px; font-size: 0.74rem; line-height: 1.2;
}
.cal-block {
  position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.7);
}
.cal-block span { display: block; padding: 2px 6px; font-size: 0.72rem; line-height: 1.2; }
.cal-block.behavior-block,
.cal-block.behavior-approval_full,
.cal-block.behavior-approval_always { background: var(--block-bg); color: var(--block-fg); opacity: 0.85; }
.cal-block.behavior-same_day { background: var(--block-bg); color: var(--block-fg); opacity: 0.6; }
.cal-block.behavior-online span { display: inline-block; margin: 2px 4px; padding: 0 5px; border-radius: 6px; background: #1a4a8a; color: #fff; font-size: 0.64rem; }
.cal-block.behavior-info { display: none; }
.cal-block.behavior-label span,
.cal-block.behavior-fill_last span { display: inline-block; margin: 2px 4px; padding: 0 5px; border-radius: 6px; background: var(--block-bg); color: var(--block-fg); font-size: 0.64rem; opacity: 0.9; }
.cal-block.behavior-fill_last { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,0.05) 6px 12px); }

/* Slot rules page */
.rule-name-input { min-width: 22rem; }
.day-tabs { display: flex; gap: 0.25rem; margin: 0.5rem 0 0.8rem; flex-wrap: wrap; }
.day-tab { padding: 0.35rem 0.9rem; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--maroon-dark); background: var(--surface); }
.day-tab.active { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.75rem; }
.template-col { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; }
.template-col h3 { font-size: 0.92rem; margin: 0.1rem 0 0.4rem; color: var(--maroon-dark); }
.template-block { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; padding: 2px 0; border-bottom: 1px solid #f0e6cf; }
.template-block form { margin: 0 0 0 auto; }
.tb-time { white-space: nowrap; font-variant-numeric: tabular-nums; color: #555; }
.tb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--block-bg); border: 1px solid rgba(0,0,0,0.25); flex: none; vertical-align: middle; }
.link-btn { background: none; border: none; color: #999; cursor: pointer; font-size: 1rem; padding: 0 0.2rem; }
.link-btn:hover { color: var(--maroon); }
.rules-forms { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.rules-form { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.9rem; flex: 1 1 320px; }
.rules-form h3 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--maroon-dark); }
.rules-form-wide { margin-top: 1rem; }
.inline-fields { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.weekday-checks { display: flex; gap: 0.7rem; flex-wrap: wrap; margin: 0.5rem 0; }
.weekday-checks label { display: flex; gap: 0.25rem; align-items: center; font-weight: 400; }
.weekday-checks input { width: auto; margin: 0; }
.column-picks { display: flex; gap: 0.3rem 0.8rem; flex-wrap: wrap; margin: 0.5rem 0; font-size: 0.85rem; }
.column-picks label, .check-line { display: flex; gap: 0.25rem; align-items: center; font-weight: 400; }
.column-picks input, .check-line input { width: auto; margin: 0; }
.check-line { margin: 0.3rem 0 0.6rem; font-size: 0.88rem; }
.coverage-box { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--maroon); border-radius: 8px; padding: 0.6rem 0.9rem; }
.coverage-box ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.apply-log { margin-top: 0.8rem; }
.apply-log summary { cursor: pointer; color: var(--maroon-dark); font-weight: 600; }
.template-block.is-hidden { opacity: 0.45; }
.kind-tag { font-size: 0.68rem; padding: 0 0.3rem; border-radius: 4px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.kind-tag.oneoff { background: #fff4d6; border-color: #e0b84c; color: #6b4a00; }
/* Online slots */
.online-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; margin: 0.4rem 0 1rem; }
.online-filters label { font-size: 0.85rem; }
.online-summary { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.online-summary .sum-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.9rem; min-width: 11rem; }
.sum-card .big { font-size: 1.4rem; font-weight: 700; color: var(--maroon-dark); }
.annie-tag { display: inline-block; font-size: 0.7rem; padding: 0 0.35rem; border-radius: 4px; background: #dbe9ff; color: #1d4f99; border: 1px solid #9dbcf0; }
.slot-booked { color: var(--success); font-weight: 600; }
.slot-open { color: #1d4f99; }
.online-col { margin-bottom: 1.4rem; }
.online-col table td, .online-col table th { padding: 0.25rem 0.5rem; }
.online-actions { position: sticky; bottom: 0; background: var(--cream); border-top: 1px solid var(--border); padding: 0.6rem 0; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* --- Users: permissions --------------------------------------------------- */
.perm-box { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; margin: 0.4rem 0 1rem; }
.perm-box legend { font-weight: 600; color: var(--maroon-dark); padding: 0 0.3rem; }
.perm-row { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; margin: 0.3rem 0; }
.perm-row input { width: auto; margin-top: 0.2rem; }

/* --- Boarding chart --------------------------------------------------------- */
.bd-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; font-size: 0.82rem; margin: -0.4rem 0 0.6rem; }
.bd-key { display: inline-block; width: 22px; height: 10px; border-radius: 5px; vertical-align: middle; margin-right: 4px; }
.bd-wrap { display: flex; gap: 14px; align-items: flex-start; }
.bd-scroll { flex: 1 1 auto; min-width: 0; overflow: auto; max-height: calc(100vh - 215px); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.bd-chart { font-size: 0.8rem; width: 100%; }
.bd-row { display: flex; }
.bd-label { position: sticky; left: 0; z-index: 4; width: 190px; flex: none; padding: 3px 8px; height: 26px; line-height: 20px; border-right: 1px solid var(--border); border-bottom: 1px solid #f1e6cc; background: #fffaf0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-track { position: relative; flex: 1 1 auto; min-width: 0; height: 26px; border-bottom: 1px solid #f1e6cc; }
.bd-head { position: sticky; top: 0; z-index: 6; }
.bd-head .bd-label { z-index: 7; background: #fde9c8; font-weight: 700; color: var(--maroon-dark); height: 38px; line-height: 32px; }
.bd-head .bd-track { height: 38px; background: #fffaf0; }
.bd-day { position: absolute; top: 0; bottom: 0; left: calc(var(--i) * 100% / var(--days)); width: calc(100% / var(--days)); text-align: center; font-size: 0.72rem; color: var(--text-muted); border-left: 1px solid #e6d7b5; padding-top: 2px; }
.bd-day b { display: block; color: var(--maroon-dark); font-size: 0.8rem; }
.bd-day.bd-today { background: var(--maroon); color: #fff; }
.bd-day.bd-today b { color: #fff; }
.bd-week { border-left: 2px solid #d9c49a !important; }
.bd-group .bd-label, .bd-group .bd-track { background: #fde9c8; font-weight: 700; color: var(--maroon-dark); }
.bd-cell { position: absolute; top: 0; bottom: 0; left: calc(var(--i) * 100% / var(--days)); width: calc(100% / var(--days)); border-left: 1px solid #f3ead6; }
a.bd-cell:hover { background: #fff3da; }
.bd-now { position: absolute; top: 0; bottom: 0; border-left: 2px solid #c00; z-index: 3; pointer-events: none; }
.bd-bar { position: absolute; top: 3px; min-width: 14px; height: 19px; border-radius: 10px; padding: 0 7px; display: flex; justify-content: space-between; gap: 4px; align-items: center; font-size: 0.72rem; white-space: nowrap; overflow: hidden; z-index: 2; text-decoration: none; }
.bd-bar:hover { z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,0.3); overflow: visible; }
.bd-bar-main { overflow: hidden; text-overflow: ellipsis; }
.bd-bar-out { flex: none; opacity: 0.85; }
.bd-cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bd-cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bd-reserved { background: #f6d79a; color: #5a3a00; border: 1px solid #d9a441; }
.bd-checked_in { background: var(--maroon); color: #fff; }
.bd-out_today { background: #5f8a63; color: #fff; }
.bd-checked_out { background: #e4ddcf; color: #6b5a40; }
.bd-side { width: 290px; flex: none; }
.bd-side .card { padding: 0.7rem 0.9rem; margin-bottom: 12px; font-size: 0.86rem; }
.bd-side h3 { margin: 0.1rem 0 0.4rem; font-size: 0.95rem; color: var(--maroon-dark); }
.bd-side ul { padding-left: 1rem; margin: 0; }
.bd-side li { margin: 0.35rem 0; }
.bd-side a { text-decoration: none; }
.bd-wait li { margin-bottom: 0.7rem; }
.bd-none { padding: 0.8rem 1rem; margin: 0; }
@media (max-width: 1100px) { .bd-wrap { flex-direction: column; } .bd-side { width: 100%; } }

/* --- Boarding stay pages ------------------------------------------------------ */
.bd-form-page { max-width: 1250px; }
.bd-cols { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.bd-cols > div { flex: 1 1 420px; min-width: 0; }
.bd-cols .card h2 { margin: 0.1rem 0 0.7rem; font-size: 1.05rem; color: var(--maroon-dark); }
.bd-check { display: flex; gap: 0.45rem; align-items: flex-start; font-weight: 400; margin: 0.3rem 0; color: var(--text); }
.bd-check[hidden] { display: none; }
.bd-check input { width: auto; margin: 0.2rem 0 0; }
.bd-inline { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; }
.bd-note { background: #fff3da; border-radius: 6px; padding: 0.5rem 0.7rem; font-size: 0.86rem; }
.bd-est td, .bd-est th { padding: 0.3rem 0.5rem; font-size: 0.88rem; }
.bd-est .num { text-align: right; white-space: nowrap; }
.bd-total td { font-weight: 700; background: #fde9c8; }
.bd-reqlist { list-style: none; padding: 0; margin: 0; }
.bd-reqlist li { margin: 0.3rem 0; }
.bd-ok { color: var(--success); font-weight: 700; }
.bd-no { color: var(--danger); font-weight: 700; }
.bd-warn { background: #ffe8b8; color: #6b4300; }
.bd-badge-reserved { background: #f6d79a; color: #5a3a00; }
.bd-badge-checked_in { background: var(--maroon); color: #fff; }
.bd-badge-checked_out { background: #e4ddcf; color: #6b5a40; }
.bd-badge-cancelled { background: #f3d6d4; color: var(--danger); }
.bd-move { margin-top: 0.8rem; }
.bd-move summary { display: inline-block; list-style: none; cursor: pointer; }
.bd-move summary::-webkit-details-marker { display: none; }
.bd-move[open] summary { margin-bottom: 0.6rem; }

/* Items catalog */
.items-table td.num, .items-table th.num, td.num, th.num { text-align: right; white-space: nowrap; }
.items-table tr.retired td { color: var(--text-muted); }
.role { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 4px; margin-right: 0.2rem; letter-spacing: 0.02em; }
.role-bill { background: #fde9c8; color: var(--maroon-dark); }
.role-stock { background: #d8e9ff; color: #1a4a8a; }
.role-rec { background: #d9f0dd; color: var(--success); }
.role-cs { background: #7A0000; color: #fff; }
.item-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem 1.2rem; }
.item-facts > div > .subtle { display: block; font-size: 0.8rem; }
.item-section.off { opacity: 0.65; }
.section-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 1.05rem; cursor: pointer; }
.section-toggle input, label.check input { width: auto; margin: 0 0.3rem 0 0; }
label.check { display: inline-flex; align-items: center; margin-right: 1.2rem; font-weight: 400; }
.section-fields { margin-top: 0.8rem; }
.pager { display: flex; gap: 0.6rem; align-items: center; }

/* Invoices */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.invoice-lines .qty-input { width: 6rem; margin: 0; text-align: right; }
.invoice-lines tr.fee-line td:nth-child(2) { padding-left: 1.6rem; color: var(--text-muted); }
.invoice-lines tr.needs-price { background: #fff3da; }
.invoice-lines tfoot td { border: none; }
.invoice-lines .total-row td { font-weight: 700; font-size: 1.05rem; }
/* Drag-and-drop line order + note lines (2026-11-16) */
.invoice-lines .drag-col { width: 2rem; padding-left: 0.5rem; padding-right: 0; }
.invoice-lines .drag-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  display: inline-block; padding: 0.35rem 0.45rem; border-radius: 4px; color: #7A0000; font-size: 1.05rem; line-height: 1; }
.invoice-lines .drag-handle:hover, .invoice-lines .drag-handle:focus { background: #FFEEC7; outline: none; }
.invoice-lines .drag-handle:focus-visible { box-shadow: 0 0 0 2px #7A0000; }
.invoice-lines tr.dragging td { background: #FFEEC7; }
.invoice-lines tr.dragging:first-child td, .invoice-lines tr.dragging td { box-shadow: inset 0 1px 0 #7A0000, inset 0 -1px 0 #7A0000; }
body.dragging-lines, body.dragging-lines * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.invoice-lines tr.note-line td { background: #fbf7ee; }
.invoice-lines .note-text { font-weight: 600; font-style: italic; }
.invoice-lines .note-edit { display: flex; gap: 0.75rem; align-items: center; }
.invoice-lines .note-edit input[name=description] { margin: 0; flex: 1 1 auto; font-weight: 600; font-style: italic; }
.invoice-lines .note-edit .check { margin: 0; white-space: nowrap; }
.order-status { padding: 0.4rem 0.9rem; font-size: 0.9rem; color: #2f6b2f; min-height: 1.6rem; }
.order-status.bad { color: #7A0000; font-weight: 600; }

/* Checkout */
.co-balance { font-size: 1.15rem; font-weight: bold; padding: 0.4rem 0.9rem; border-radius: 8px; }
.co-balance.owes { background: #f3d6d4; color: var(--danger); }
.co-balance.credit { background: #d9f0dd; color: var(--success); }
.co-owing .co-tick { width: 2rem; text-align: center; }
.co-owing tr.co-unticked td { color: var(--text-muted); }
.co-owing tr.co-unticked td strong { font-weight: normal; text-decoration: line-through; }
.co-balance.even { background: #eee7d6; color: var(--text-muted); }
tr.co-void td { color: var(--text-muted); text-decoration: line-through; }
tr.co-void td .badge, tr.co-void td .subtle { text-decoration: none; }

/* Medical records: visit page, vital signs, entries, medical history */
.section-h { color: var(--maroon-dark); font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.mr-table td { vertical-align: top; }
.mr-cat { display: inline-block; font-size: 0.72rem; padding: 0.05rem 0.4rem; border-radius: 999px;
          background: #eee7d6; color: var(--text-muted); margin-left: 0.25rem; white-space: nowrap; }
.mr-comment { white-space: pre-wrap; }
.mr-error td, .mr-error .mr-comment { text-decoration: line-through; color: var(--text-muted); }
.mr-error .actions-cell { text-decoration: none; }
.mr-cat-checks { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; margin-top: 0.5rem; }
.mr-cat-checks label.check { margin: 0; font-weight: normal; }
.vitals-row .field { flex: 1 1 120px; }
.mr-locked-note { background: #fff6e0; border-left: 4px solid #c58a00; }
.mr-picked { min-height: 1.1em; margin: 0.15rem 0 0.35rem; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 0.75rem; }
.mr-table td:first-child { white-space: nowrap; }
.log-before { text-decoration: line-through; color: var(--text-muted); }

/* Pain scores (CSU Acute Pain Scale 0-4) */
.pain-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; margin: 0.25rem 0 0.6rem; }
.pain-level { display: flex; flex-direction: column; gap: 0.2rem; border: 2px solid #e2d6b8; border-radius: 8px;
              padding: 0.45rem 0.5rem; background: #fffdf6; cursor: pointer; font-weight: normal; margin: 0; position: relative; }
.pain-level input { position: absolute; opacity: 0; pointer-events: none; }
.pain-level .pain-num { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.pain-level .pain-name { font-weight: 600; font-size: 0.85rem; }
.pain-level .pain-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.3; }
.pain-level:has(input:checked) { border-color: var(--maroon); background: #fff3d6; box-shadow: 0 0 0 2px rgba(122,0,0,0.15); }
.pain-level:has(input:focus-visible) { outline: 2px solid var(--maroon); outline-offset: 2px; }
.pain-level-0 .pain-num { color: #2e7d32; }
.pain-level-1 .pain-num { color: #7a8f00; }
.pain-level-2 .pain-num { color: #c58a00; }
.pain-level-3 .pain-num { color: #d35400; }
.pain-level-4 .pain-num { color: #b00020; }
.pain-warn, .pain-alert { background: #fdecea; border-left: 4px solid #b00020; color: #7a0000; padding: 0.5rem 0.75rem;
                          border-radius: 4px; margin-bottom: 0.6rem; }
.pain-recheck { background: #fff6e0; border-left: 4px solid #c58a00; }
.pain-recheck.overdue { background: #fdecea; border-left-color: #b00020; color: #7a0000; }
.pain-badge { display: inline-block; min-width: 2.4em; text-align: center; font-weight: 700; font-size: 0.82rem;
              padding: 0.05rem 0.4rem; border-radius: 999px; color: #fff; }
.pain-badge-0 { background: #2e7d32; } .pain-badge-1 { background: #7a8f00; } .pain-badge-2 { background: #c58a00; }
.pain-badge-3 { background: #d35400; } .pain-badge-4 { background: #b00020; }
@media (max-width: 700px) { .pain-levels { grid-template-columns: 1fr; } .pain-level { flex-direction: row; flex-wrap: wrap; align-items: baseline; } .pain-level .pain-desc { flex-basis: 100%; } }

/* End of day and reports print cleanly: no nav, no forms. */
@media print {
  .topbar, .no-print, .flash, .gs-overlay { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* BarnLogs (controlled substances) */
.bl-tabs { margin-top: -0.4rem; }
.bl-sign { border-top: 1px dashed var(--border); margin-top: 0.8rem; padding-top: 0.6rem; }
.bl-warn { background: #f3d6d4; color: var(--danger); padding: 0.5rem 0.8rem; border-radius: 6px; margin: 0.4rem 0; }
.bl-note { background: #fff3da; padding: 0.5rem 0.8rem; border-radius: 6px; margin: 0.4rem 0; }
.bl-req { font-size: 0.72rem; font-weight: 700; color: var(--maroon); text-transform: uppercase; letter-spacing: 0.03em; }
.bl-status { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 4px; white-space: nowrap; }
.bl-status-pending { background: #fde9c8; color: var(--maroon-dark); }
.bl-status-fix_needed { background: #f3d6d4; color: var(--danger); }
.bl-status-archived { background: #d9f0dd; color: var(--success); }
.bl-status-ignored { background: #eee7d6; color: var(--text-muted); }
.bl-status-unopened { background: #d8e9ff; color: #1a4a8a; }
.bl-status-opened { background: #d9f0dd; color: var(--success); }
.bl-status-awaiting_disposal { background: #ffe8b8; color: #8a5a00; }
.bl-status-finished { background: #eee7d6; color: var(--text-muted); }
.bl-neg { color: var(--danger); font-weight: 700; }
.bl-inline { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; margin: 0 1.2rem 0.4rem 0; }
.bl-inline input[type=checkbox] { width: auto; margin: 0; flex: none; }
.bl-table td { vertical-align: top; }
.bl-table tr.bl-ignored td { color: var(--text-muted); text-decoration: line-through; }
.bl-table tr.bl-ignored td.bl-keep { text-decoration: none; }
.bl-table tr.bl-row { cursor: pointer; }
.bl-table tr.bl-row:hover td { background: #fff8e6; }
.bl-comment { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.bl-foot { display: flex; gap: 1.4rem; flex-wrap: wrap; padding: 0.6rem 0.9rem; }
.bl-cont { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.bl-cont-card { border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; flex: 1 1 250px; background: #fffdf7; }
.bl-cont-card.bl-unopened { background: #f6f9ff; }
.bl-cont-card .form-row { gap: 0.5rem; }
.bl-cont-card .field { flex: 1 1 90px; margin: 0; }
.bl-cont-card input { margin: 0; }
.bl-cont-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; margin-bottom: 0.35rem; }
.bl-drug-block { border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.8rem; background: var(--surface); }
.bl-results { border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow-y: auto; margin-top: 0.3rem; background: #fff; }
.bl-results button { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 0.45rem 0.7rem; cursor: pointer; font-size: 0.95rem; }
.bl-results button:hover { background: #fff3da; }
.bl-picked { background: #d9f0dd; border-radius: 8px; padding: 0.5rem 0.8rem; display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.bl-total { font-weight: 700; }
/* BarnLogs step 2: Reconcile */
.bl-count { display: inline-block; min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; background: var(--maroon); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.3rem; text-align: center; }
.btn:not(.btn-secondary) .bl-count { background: #fff; color: var(--maroon); }
.bl-subtabs { display: flex; gap: 0.3rem; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin: 0.6rem 0 0.8rem; }
.bl-subtabs a { padding: 0.45rem 0.8rem; text-decoration: none; color: var(--text); border-radius: 6px 6px 0 0; font-weight: 600; }
.bl-subtabs a.active { background: var(--maroon); color: #fff; }
.bl-subtabs a .subtle { font-weight: 400; }
.bl-subtabs a.active .subtle { color: #fde9c8; }
.bl-stale { display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--danger); margin-top: 0.15rem; }
.bl-fix { color: var(--danger); font-size: 0.88rem; }
.bl-bulk { background: var(--surface); border-top: 2px solid var(--maroon); padding: 0.7rem 0.9rem; border-radius: 0 0 10px 10px; margin-bottom: 1rem; }
.bl-check { width: 1.1rem; height: 1.1rem; margin: 0; }
.bl-line-status { display: inline-block; margin-top: 0.15rem; font-size: 0.8rem; }

.bl-actions details { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.8rem; margin-bottom: 0.5rem; background: var(--surface); }
.bl-actions summary { cursor: pointer; font-weight: 700; color: var(--maroon-dark); }
.bl-sigpad { border: 1px solid var(--border); border-radius: 8px; background: #fff; touch-action: none; width: 100%; max-width: 480px; height: 160px; display: block; }
.bl-sigimg { max-width: 320px; max-height: 110px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.bl-table td:first-child { white-space: nowrap; }
.day-rules-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.day-rules-grid .tb-name { white-space: nowrap; min-width: 0; }
.hex-input { width: 6.2rem; margin-left: 0.3rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.hex-input.bad { border-color: var(--danger); background: #fff0ef; }

/* List filters: multi-pick drop-downs (product groups) */
.lf-pick { position: relative; }
.lf-pick-sum { list-style: none; cursor: pointer; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); min-width: 12rem; white-space: nowrap; }
.lf-pick-sum::-webkit-details-marker { display: none; }
.lf-pick-sum::after { content: " ▾"; color: var(--text-muted); }
.lf-pick-menu { position: absolute; z-index: 30; top: 100%; left: 0; margin-top: 0.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); padding: 0.5rem; width: 20rem; }
.lf-pick-options { max-height: 18rem; overflow-y: auto; }
.lf-pick-options label { display: flex; gap: 0.45rem; align-items: center; font-weight: 400; color: var(--text); margin: 0.2rem 0; }
.lf-pick-options input { width: auto; margin: 0; }
.lf-pick-tools { margin: 0.35rem 0; }
.lf-pick-find { width: 100%; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link.on { text-decoration: underline; }

/* Inventory counts */
.count-table input.count-qty { width: 7rem; }
.count-warn { color: var(--danger); font-weight: 600; }
.count-ok { color: var(--success); }
.count-table tr.count-mismatch td { background: #fff6f4; }
.count-fix { position: relative; }
.count-fix summary { list-style: none; display: inline-block; }
.count-fix summary::-webkit-details-marker { display: none; }
.count-fix-menu { margin-top: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); padding: 0.6rem; max-width: 14rem; display: grid; gap: 0.4rem; }
.count-fix-menu label { display: grid; gap: 0.2rem; font-weight: 400; }
.count-builder { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; align-items: start; }
.cb-results { max-height: 28rem; overflow-y: auto; }
.cb-results tr { cursor: pointer; }
.tick-table td.tick-cell { width: 2.2rem; text-align: center; }
.tick-table input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--maroon); cursor: pointer; }
.tick-table tr.ticked td { background: #fff3d6; }
.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-form select { width: auto; }
/* Type-to-narrow picker (static/js/typeahead.js) */
.ta-wrap { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; margin: 2px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.15); max-height: 320px; overflow-y: auto; }
.ta-list[hidden] { display: none; }
.ta-item { padding: 0.4rem 0.7rem; cursor: pointer; border-bottom: 1px solid #f3ead6; }
.ta-item:last-child { border-bottom: none; }
.ta-item.ta-active, .ta-item:hover { background: #fff3da; }
.ta-label { font-weight: 600; color: var(--maroon-dark); }
.ta-sub { font-size: 0.82rem; color: var(--text-muted); }
.ta-empty { padding: 0.5rem 0.7rem; color: var(--text-muted); font-size: 0.88rem; }

/* Hover summaries (summaries.py + static/js/hovercard.js) */
.hovercard { position: fixed; z-index: 1000; background: #fffdf5; border: 1px solid #c9b98f; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.22); padding: 0.8rem 1rem; max-width: min(860px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; font-size: 0.86rem; line-height: 1.35; color: #222; }
.hc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.4rem 1.2rem; }
.hc-facts { margin: 0; }
.hc-facts > div { margin-bottom: 0.15rem; }
.hc-facts dt { display: inline; text-transform: uppercase; font-size: 0.74rem; color: #6b6b6b; letter-spacing: 0.02em; margin-right: 0.3rem; }
.hc-facts dd { display: inline; margin: 0; font-weight: 600; }
.hc-pre { white-space: pre-line; }
.hc-alert { background: #fde8e6; color: var(--danger); border-radius: 6px; padding: 0.3rem 0.5rem; margin-top: 0.3rem; }
.hc-owes { color: var(--danger); }
.hc-section { border-top: 1px solid #ddd2b4; margin-top: 0.55rem; padding-top: 0.45rem; }
.hc-h { text-transform: uppercase; font-size: 0.74rem; color: #6b6b6b; letter-spacing: 0.02em; margin-bottom: 0.25rem; }
.hc-soc { width: 100%; border-collapse: collapse; }
.hovercard .hc-soc th { text-align: left; font-size: 0.78rem; color: #444; background: none; padding: 0.15rem 0.4rem; border: none; position: static; }
.hc-soc td { padding: 0.2rem 0.4rem; vertical-align: top; }
.hc-soc tbody tr:nth-child(odd) { background: #f3eedf; }
.hc-soc tr.hc-overdue td { color: var(--danger); font-weight: 700; }
[data-hover-url] { cursor: help; }
.cal-card[data-hover-url] { cursor: pointer; }
/* BarnLogs step 4: comment templates, notifications, cocktails, weight tracking */
.bl-tpl-edit { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.bl-tpl-edit input { margin: 0; flex: 1 1 auto; min-width: 12rem; }
.bl-notice { border-left: 5px solid #e0a300; padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; background: var(--surface); border-radius: 6px; display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.bl-notice.bl-alert { border-left-color: var(--danger); background: #fbeceb; }
.bl-notice .bl-notice-title { font-weight: 700; }
.bl-notice details { flex: 1 1 100%; }
.bl-weights { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.bl-flag { color: var(--danger); font-size: 0.85rem; margin-top: 0.2rem; }
.bl-flag.bl-explained { color: var(--text-muted); }
.bl-ing { border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.8rem; background: var(--surface); }
.bl-recipe td input, .bl-recipe td select { margin: 0; }
.bl-calc { background: #fff8e6; border-radius: 8px; padding: 0.5rem 0.8rem; margin-top: 0.4rem; }

/* ---- Whiteboard, treatment sheet and wall display (VetRadar-style, Mike 2026-11-12) ----
   Patient cards down the left, critical notes in pink, then Missed, Due and
   one column per hour with a box per task group. Box stripe = group color;
   red = missed, orange = due now, blue outline = coming up, green check = done. */
.container-flush { padding: 0.6rem 0.8rem 2rem; }
.vr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 0.5rem; }
.vr-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; flex: 1 1 520px; margin: 0; }
.vr-filters input[type=search] { width: 15rem; max-width: 100%; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; }
.vr-seg { display: inline-flex; border: 1px solid #c9b98f; border-radius: 8px; overflow: hidden; }
.vr-seg a { padding: 0.4rem 0.8rem; text-decoration: none; color: var(--text); background: #fff; font-size: 0.9rem; border-right: 1px solid #e5d7b2; }
.vr-seg a:last-child { border-right: none; }
.vr-seg a.active { background: var(--maroon); color: var(--cream); }
.vr-sort { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; }
.vr-sort select { width: auto; padding: 0.35rem 0.4rem; }
.vr-time-nav, .vr-wall-links { display: flex; align-items: center; gap: 0.4rem; }
.vr-clock-small { font-weight: 700; font-size: 1.15rem; margin-right: 0.4rem; font-variant-numeric: tabular-nums; }
.vr-back { font-weight: 600; text-decoration: none; }
.vr-dayname { font-weight: 700; padding: 0 0.3rem; }
.vr-summary, .vr-wall-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; margin: 0 0 0.5rem; font-size: 0.9rem; }
.vr-sum strong { font-size: 1.05rem; }
.vr-sum-red strong { color: #c62828; }
.vr-sum-amber strong { color: #c46a00; }
.vr-sum-crit { background: #c62828; color: #fff; padding: 0.1rem 0.5rem; border-radius: 4px; }
.vr-sum-crit strong { color: #fff; }
.vr-legend { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; font-size: 0.8rem; color: var(--text-muted); }
.vr-key { padding: 0.05rem 0.45rem; border-radius: 4px; border: 2px solid; background: #fff; }
.vr-key-missed { border-color: #d32f2f; background: #fde3e3; }
.vr-key-due { border-color: #ef8a00; background: #fff1dc; }
.vr-key-up { border-color: #2f6fb0; }
.vr-key-done { border-color: #6aa84f; color: #3d7a2a; }
.vr-cat-key::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; background: var(--cat); border-radius: 2px; margin-right: 0.3em; vertical-align: -0.05em; }

.vr-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.vr-board { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 1100px; }
.vr-col-card { width: 330px; }
.vr-col-crit { width: 115px; }
.vr-col-hour { width: auto; min-width: 88px; }
.vr-board th { position: sticky; top: 0; z-index: 2; background: #fff; font-weight: 600; font-size: 0.85rem; padding: 0.45rem 0.25rem; text-align: center; border-bottom: 1px solid #e6e1d6; white-space: nowrap; }
.vr-board th.vr-card-h { text-align: left; padding-left: 0.6rem; color: var(--text-muted); font-weight: 500; position: sticky; left: 0; z-index: 3; }
.vr-board th.vr-now { color: #fff; background: var(--maroon); border-radius: 6px 6px 0 0; }
.vr-board th.vr-past { color: #9a8f7c; }
.vr-day { display: block; font-size: 0.68rem; font-weight: 500; color: inherit; opacity: 0.8; }
.vr-pill { display: inline-block; min-width: 1.4em; padding: 0 0.35em; border-radius: 999px; color: #fff; font-size: 0.75rem; line-height: 1.4; }
.vr-pill-red { background: #d32f2f; }
.vr-pill-amber { background: #ef8a00; }
.vr-board td { border-bottom: 1px solid #ece7dc; border-right: 1px solid #f1ede4; vertical-align: top; padding: 4px; }
.vr-board td.vr-now { background: #fff8ec; }
.vr-cell { text-align: center; }
.vr-cell-missed { background: #fffafa; }

/* Patient card */
.vr-card { position: sticky; left: 0; z-index: 1; background: #fff; padding: 4px 6px 4px 4px !important; }
.vr-card > * { position: relative; }
.vr-card::before { content: ""; position: absolute; inset: 3px 4px 3px 3px; border-radius: 6px; background: #eef4f8; }
.vr-area-boarding.vr-card::before, .vs-patient.vr-area-boarding { background: #c8e9f8; }
.vr-area-treatment.vr-card::before, .vs-patient.vr-area-treatment { background: #f7dfc5; }
.vr-row-critical .vr-card::before { box-shadow: inset 5px 0 0 #c62828; }
.vr-card { font-size: 0.82rem; line-height: 1.3; }
.vr-card > div { padding: 0 6px 0 10px; }
.vr-card-top { display: flex; gap: 0.55rem; padding-top: 6px !important; }
.vr-avatar-wrap { display: flex; flex-direction: column; align-items: center; flex: none; width: 70px; }
.vr-avatar { width: 52px; height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; color: #fff; background: #8a7a5c; }
.vr-sp-canine { background: #b0703a; } .vr-sp-feline { background: #5d6f8c; } .vr-sp-avian { background: #3f8f7a; }
.vr-sp-lagomorph, .vr-sp-rodent { background: #9a6fa0; } .vr-sp-reptile { background: #6b8e23; }
.vr-sp-caprine, .vr-sp-porcine, .vr-sp-equine, .vr-sp-bovine { background: #7d6b4f; }
.vr-demeanor { margin-top: -6px; padding: 0 0.3rem; border-radius: 3px; font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; color: #fff; background: #333; white-space: nowrap; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
.vr-demeanor { font-size: 0.6rem; letter-spacing: 0; }
.vr-muzzle { color: #d32f2f; font-weight: 700; white-space: nowrap; }
.vr-tone-green { background: #1fa6b8; } .vr-tone-amber { background: #d9822b; } .vr-tone-red { background: #d32f2f; } .vr-tone-none { background: #333; }
.vr-card-main { flex: 1; min-width: 0; }
.vr-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.vr-name a { color: var(--text); text-decoration: none; }
.vr-name a:hover { text-decoration: underline; }
.vr-flag-critical { background: #c62828; color: #fff; font-size: 0.62rem; padding: 0.05rem 0.3rem; border-radius: 3px; vertical-align: 0.2em; letter-spacing: 0.04em; }
.vr-species { font-style: italic; color: #5d5446; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-line { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 2px; }
.vr-line > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-owner { text-align: right; }
.vr-stay { margin: 3px 6px 2px 10px !important; padding: 2px 6px !important; background: #fff; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-doc { color: var(--text-muted); }
.vr-standing { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 6px 4px 10px !important; padding: 0 !important; }
.vr-standing span { background: #fff; border-left: 4px solid var(--cat); border-radius: 3px; padding: 0 5px; font-size: 0.75rem; }

/* Critical notes (pink column) */
.vr-crit { background: #fff; padding: 3px !important; }
.vr-crit > * { font-size: 0.78rem; }
.vr-board td.vr-crit { background: linear-gradient(#fde1e3, #fde1e3) content-box; }
.vr-crit-text, .vr-crit-alert, .vr-code { padding: 4px 5px; white-space: pre-wrap; text-transform: uppercase; font-weight: 600; color: #5c1010; }
.vr-crit-alert { color: #b00020; }
.vr-code { display: inline-block; margin: 4px 0 0 4px; padding: 0 5px; border-radius: 3px; color: #fff; background: #2f6fb0; }
.vr-code-dnr { background: #c62828; }

/* Task boxes */
.vr-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; min-height: 60px; margin: 0 0 4px; padding: 6px 4px; background: #fff; border: 1px solid #2f6fb0; border-left: 5px solid var(--cat, #2f6fb0); border-radius: 3px; color: #1d2b3a; font: inherit; font-size: 0.8rem; cursor: pointer; }
button.vr-box:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.vr-count { display: inline-flex; align-items: center; gap: 4px; font-size: 1.05rem; font-weight: 600; }
.vr-clock { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.vr-group { font-size: 0.75rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.vr-box.vr-upcoming .vr-count { color: #2f6fb0; }
.vr-box.vr-due { border-color: #ef8a00; background: #fff1dc; }
.vr-box.vr-due .vr-count { color: #b35f00; }
.vr-box.vr-overdue { border-color: #d32f2f; background: #fde3e3; }
.vr-box.vr-overdue .vr-count { color: #c62828; }
.vr-box.vr-done, .vr-box.vr-skipped { border-color: #6aa84f; }
.vr-check { color: #4c9a2a; font-size: 1.5rem; line-height: 1; font-weight: 700; }
.vr-box.vr-done .vr-group { color: #6b7a5e; }
.vr-empty { margin: 1rem; }

/* Tasks side panel */
.vr-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: #fff; z-index: 200; box-shadow: -8px 0 28px rgba(0,0,0,0.22); overflow-y: auto; padding: 0 0 5rem; }
.vr-panel[hidden] { display: none; }
.vr-panel-close { position: absolute; top: 0.4rem; right: 0.6rem; background: none; border: none; font-size: 2rem; line-height: 1; cursor: pointer; color: #444; z-index: 2; }
.vr-panel-head { position: sticky; top: 0; background: #fff; z-index: 1; border-bottom: 1px solid #e6e1d6; }
.vr-panel-title { text-align: center; font-size: 1.25rem; padding: 0.8rem 2.5rem 0.4rem; color: #1d2b3a; }
.vr-panel-patient { background: #c8e9f8; padding: 0.5rem 0.9rem; display: flex; flex-direction: column; }
.vr-panel-patient a { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.vr-panel-crit { background: #d32f2f; color: #fff; font-weight: 700; padding: 0.4rem 0.9rem; text-transform: uppercase; white-space: pre-wrap; font-size: 0.85rem; }
.vr-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
.vr-tabs a { text-align: center; padding: 0.55rem 0.2rem; text-decoration: none; color: var(--text); font-weight: 600; border-bottom: 3px solid transparent; }
.vr-tabs a.active { background: #dbe9f7; color: #1f5d9a; border-bottom-color: #2f6fb0; }
.vr-hour-nav { display: flex; align-items: center; gap: 0.7rem; padding: 0.4rem 0.9rem; }
.vr-hour-nav a { text-decoration: none; font-size: 1.8rem; line-height: 1; color: var(--text); padding: 0 0.3rem; }
.vr-hour-big { font-size: 1.6rem; font-weight: 700; }
.vr-task-form { padding: 0 0.9rem; }
.vr-selectall { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0; font-weight: 600; }
.vr-task-group { margin: 0.6rem -0.9rem 0; padding: 0.35rem 0.9rem; background: #e8eef6; font-weight: 700; border-left: 6px solid var(--cat); }
.vr-task { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.vr-task-line { display: flex; align-items: center; gap: 0.5rem; }
.vr-task-line input[type=checkbox] { width: 1.25rem; height: 1.25rem; flex: none; }
.vr-task-name { flex: 1; font-weight: 600; }
.vr-task-when { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.vr-late { color: #c62828; font-weight: 700; }
.vr-task-instr { font-size: 0.82rem; color: var(--text-muted); margin: 0.15rem 0 0 1.75rem; }
.vr-task-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; margin: 0.35rem 0 0 1.75rem; }
.vr-task-inputs input { padding: 0.35rem 0.5rem; font-size: 0.88rem; }
.vr-task-overdue .vr-task-name { color: #b00020; }
.vr-task-done .vr-task-name, .vr-task-skipped .vr-task-name { color: #555; }
.vr-task-done-mark, .vr-task-done { color: #4c9a2a; font-weight: 700; width: 1.25rem; text-align: center; }
.vr-task-result { font-size: 0.82rem; margin: 0.15rem 0 0 1.75rem; color: #444; }
.linklike { background: none; border: none; color: var(--maroon); text-decoration: underline; cursor: pointer; padding: 0 0.3rem; font: inherit; }
.vr-panel-actions { position: fixed; bottom: 0; right: 0; width: min(480px, 100vw); display: flex; gap: 0.5rem; align-items: center; padding: 0.7rem 0.9rem; background: #fff; border-top: 1px solid #e6e1d6; }
.vr-initials { width: 5.5rem !important; text-transform: uppercase; }

/* Treatment sheet */
.vs-wrap { display: flex; gap: 0.8rem; align-items: flex-start; }
.vs-main { flex: 1; min-width: 0; }
.vs-side { width: 290px; flex: none; display: flex; flex-direction: column; gap: 0.6rem; }
.vs-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 100%; width: calc(230px + 24 * 54px); }
.vs-grid th, .vs-grid td { border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; }
.vs-grid thead th { position: sticky; top: 0; background: #fff; z-index: 2; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0; text-align: center; white-space: nowrap; width: 54px; }
.vs-grid thead th.vr-now { color: #fff; background: var(--maroon); }
.vs-grid thead th.vr-past { color: #9a8f7c; }
.vs-dayrow th { font-weight: 500 !important; color: var(--text-muted); text-align: left !important; border-right: none !important; overflow: visible; }
.vs-dayrow th.vs-daystart { border-left: 2px solid #9aa5b5; padding-left: 4px !important; }
.vs-grid .vs-label-h, .vs-grid .vs-label { position: sticky; left: 0; z-index: 3; width: 230px; background: #fff; text-align: left; }
.vs-label { padding: 0.3rem 0.5rem 0.3rem 0.6rem; font-weight: 500; font-size: 0.85rem; border-left: 5px solid var(--cat); }
.vs-label a { color: var(--text); text-decoration: none; display: block; line-height: 1.2; }
.vs-label a:hover { text-decoration: underline; }
.vs-sub { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.vs-group td { background: #dfe6f3; }
.vs-group .vs-label { background: #c9d6ee; font-weight: 700; }
.vs-inactive .vs-label a { color: #8a8a8a; text-decoration: line-through; }
.vs-cell { position: relative; padding: 2px; text-align: center; vertical-align: middle; height: 2.5rem; background: #f6f8fc; }
.vs-cell.vr-past { background: #fff; }
.vs-cell.vr-now { background: #fff; }
.vs-cell.vr-now::after { content: ""; position: absolute; top: 0; bottom: -1px; left: calc(var(--now-frac) * 100%); width: 2px; background: #2f6fb0; pointer-events: none; z-index: 1; }
.vs-cell.vs-cri { background: repeating-linear-gradient(90deg, #e3eefb, #e3eefb 6px, #f6f8fc 6px, #f6f8fc 12px); }
.vs-chip { display: inline-flex; align-items: center; justify-content: center; width: 46px; min-height: 30px; margin: 1px 0; padding: 1px 2px; font: inherit; font-size: 0.72rem; line-height: 1.1; background: #fff; border: 2px solid #2f6fb0; border-radius: 4px; color: #1f5d9a; cursor: pointer; overflow: hidden; word-break: break-word; }
.vs-chip .vr-clock { width: 1.2rem; height: 1.2rem; }
.vs-done { border-color: #6aa84f; color: #2f3b26; position: relative; }
.vs-done::after { content: ""; position: absolute; right: 0; bottom: 0; border: 5px solid transparent; border-right-color: var(--cat); border-bottom-color: var(--cat); }
.vs-skipped { border-color: #9e9e9e; color: #757575; text-decoration: line-through; }
.vs-due { border-color: #ef8a00; background: #fff1dc; color: #b35f00; }
.vs-overdue { border-color: #d32f2f; background: #fde3e3; color: #c62828; }
.vs-log { margin-top: 0.2rem; font-size: 0.78rem; }
.vs-log summary { cursor: pointer; color: var(--maroon); }
.vs-log form { display: grid; gap: 0.25rem; margin-top: 0.25rem; }
.vs-log input { padding: 0.25rem 0.4rem; font-size: 0.8rem; }
.vs-help { margin: 0.5rem 0; font-size: 0.82rem; }
.vs-patient { padding: 0.7rem 0.8rem; border-radius: 8px; font-size: 0.9rem; line-height: 1.4; }
.vs-pname a { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.vs-owner { margin-top: 0.3rem; }
.vs-owner a { color: var(--text); font-weight: 600; }
.vs-critical { background: #d32f2f; color: #fff; border-radius: 8px; padding: 0.7rem 0.8rem; font-weight: 700; text-transform: uppercase; }
.vs-crit-flag { font-size: 0.85rem; letter-spacing: 0.04em; }
.vs-crit-text { white-space: pre-wrap; margin: 0.3rem 0; }
.vs-crit-alert { font-size: 0.8rem; text-transform: none; font-weight: 600; }
.vs-crit-edit { color: #fff; text-transform: none; font-weight: 600; display: inline-block; margin-top: 0.3rem; }
.vs-box { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.88rem; }
.vs-box-h { font-weight: 700; display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.vs-box-h a { font-weight: 500; }
.vs-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.6rem; margin: 0; }
.vs-dl dt { color: var(--text-muted); }
.vs-dl dd { margin: 0; }

/* Wall display: a monitor in Treatment or Boarding, read from across the room */
.vr-wall-page { background: #fff; margin: 0; }
.vr-wall-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 1rem 0.3rem; background: #fff; border-bottom: 3px solid var(--maroon); }
.vr-wall-clock { font-size: clamp(2rem, 3.6vw, 4.2rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vr-wall-date { font-size: clamp(0.9rem, 1.3vw, 1.5rem); font-weight: 500; color: #444; }
.vr-wall-title { text-align: center; font-size: clamp(1rem, 1.6vw, 1.9rem); font-weight: 700; color: var(--maroon-dark); display: flex; flex-direction: column; line-height: 1.15; }
.vr-wall-brand { font-size: 0.6em; font-weight: 500; color: var(--text-muted); }
.vr-wall-tools { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.vr-wall-tools a, .vr-wall-tools button { padding: 0.3rem 0.6rem; border: 1px solid #c9b98f; border-radius: 6px; background: #fff; color: var(--text); text-decoration: none; font: inherit; font-size: 0.85rem; cursor: pointer; }
.vr-wall-tools a.active { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.vr-wall-status { background: #c62828; color: #fff; padding: 0.3rem 0.6rem; border-radius: 6px; font-weight: 700; }
#wall-body { padding: 0.4rem 0.6rem; }
.vr-wall-summary { font-size: clamp(0.9rem, 1.2vw, 1.4rem); padding: 0 0.3rem; }
.vr-wall { border: none; font-size: clamp(0.9rem, 0.95vw, 1.25rem); }
.vr-wall .vr-board { min-width: 0; }
.vr-wall .vr-col-card { width: 27%; }
.vr-wall .vr-col-crit { width: 9%; }
.vr-wall .vr-board th { font-size: 1.05em; }
.vr-wall .vr-card { font-size: 0.95em; }
.vr-wall .vr-name { font-size: 1.35em; }
.vr-wall .vr-box { min-height: 3.6em; font-size: 1em; cursor: default; }
.vr-wall .vr-count { font-size: 1.45em; }
.vr-wall .vr-group { font-size: 0.85em; }
.vr-wall .vr-crit > * { font-size: 0.95em; }
.vr-wall .vr-box.vr-overdue { animation: vr-pulse 2s ease-in-out infinite; }
@keyframes vr-pulse { 50% { background: #f8b9b9; } }
@media (prefers-reduced-motion: reduce) { .vr-wall .vr-box.vr-overdue { animation: none; } }

@media (max-width: 1100px) {
  .vs-wrap { flex-direction: column; }
  .vs-side { width: 100%; }
}
@media (max-width: 700px) {
  .vr-board { min-width: 760px; }
  .vr-col-card { width: 210px; }
  .vr-col-crit { width: 80px; }
  .vr-avatar-wrap { width: 46px; }
  .vr-avatar { width: 40px; height: 36px; font-size: 0.95rem; }
  .vr-owner, .vr-line > span:nth-child(2) { display: none; }
  .vr-legend { margin-left: 0; }
  .vs-grid .vs-label-h, .vs-grid .vs-label { width: 150px; }
  .vs-grid { width: calc(150px + 24 * 50px); }
  .vr-wall-head { flex-wrap: wrap; }
}
.vr-board th, .vs-grid th { color: #1d2b3a; }
.vr-board th.vr-now, .vs-grid thead th.vr-now { color: #fff; }
.vr-board th.vr-past, .vs-grid thead th.vr-past { color: #9a8f7c; }
.vs-dayrow th { color: var(--text-muted) !important; }
.vr-board th.vr-h-missed { color: #c62828; }
.vr-board th.vr-h-due { color: #b35f00; }
/* Hour headings on the treatment sheet open that hour's tasks */
.vs-hour-btn { background: none; border: none; font: inherit; color: inherit; cursor: pointer; padding: 0.15rem 0.1rem; width: 100%; border-radius: 4px; }
.vs-hour-btn:hover { background: #dbe9f7; color: #1f5d9a; text-decoration: underline; }
.vr-panel-actions { flex-direction: column; align-items: stretch; }
.vr-action-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.vr-admin-row { padding-top: 0.5rem; border-top: 1px dashed #e0d6c0; }
.vr-admin-row input[type=datetime-local] { width: auto; flex: 1 1 11rem; padding: 0.4rem; }
.vr-admin-tag { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: #fff; background: #6b5a40; padding: 0.1rem 0.35rem; border-radius: 3px; }
.vr-panel { padding-bottom: 8rem; }

/* Wall display: header and column headings stay put while the board scrolls */
.vr-wall-page .vr-wall-head { position: sticky; top: 0; z-index: 20; }
.vr-wall-page .vr-scroll.vr-wall { overflow: visible; }
.vr-wall-page .vr-wall .vr-board thead th { top: var(--wall-head-h, 70px); }
.vr-wall-scrollnote { font-size: 0.85rem; color: var(--text-muted); }
.vr-board, .vs-grid { overflow: visible; border-radius: 0; }
/* Multi-step tasks (Mike, 2026-11-12): tick each step as it's done */
.vr-steps { margin: 0.4rem 0 0 1.75rem; padding: 0.4rem 0.6rem; background: #f7f4ec; border-radius: 6px; }
.vr-steps-head { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); display: flex; justify-content: space-between; margin-bottom: 0.2rem; }
.vr-steps-count { text-transform: none; font-weight: 600; color: #1f5d9a; }
.vr-step { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.92rem; cursor: pointer; border-bottom: 1px solid #ece6d6; }
.vr-step:last-of-type { border-bottom: none; }
.vr-step input { width: 1.3rem; height: 1.3rem; flex: none; }
.vr-step span:first-of-type { flex: 1; }
.vr-step-done span:first-of-type { text-decoration: line-through; color: #6b7a5e; }
.vr-step-by { font-size: 0.75rem; color: #4c9a2a; font-weight: 700; }
.vr-step-msg { color: #c62828; font-weight: 600; font-size: 0.85rem; margin-top: 0.3rem; }
.vr-steps-done { list-style: none; margin: 0.2rem 0 0 1.75rem; padding: 0; font-size: 0.82rem; color: #444; }
/* Wall header: three fixed columns so the centered title never shifts when
   the clock or the scroll indicator change width (Mike, 2026-11-12). */
.vr-wall-head { display: grid; grid-template-columns: 1fr auto 1fr; }
.vr-wall-clock { justify-self: start; }
.vr-wall-tools { justify-self: end; }
.vr-wall-scrollnote { display: inline-block; min-width: 8.5em; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Change history (audit log) */
.audit-table td { vertical-align: top; }
.audit-changes { margin: 0; padding-left: 1rem; font-size: 0.85rem; }
.audit-changes li { margin: 0.1rem 0; word-break: break-word; }
.audit-before { color: #7A0000; text-decoration: line-through; }
.audit-after { color: #2f6b2f; font-weight: 600; }
.audit-pages { display: flex; gap: 0.75rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* Boarding: check-in / check-out time next to the button; codes table. */
.bd-when-form { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }
.bd-when-form input[type=datetime-local] { width: auto; margin: 0; padding: 0.2rem 0.35rem; font-size: 0.85rem; }
.bd-codes td, .bd-codes th { vertical-align: top; }
.line-boarding { font-size: 0.78rem; }
/* Boarding vaccine check */
.bd-vacc { border: 1px solid #e3d3a8; border-radius: 6px; padding: 0.5rem 0.7rem; margin: 0.3rem 0 0.6rem; font-size: 0.9rem; background: #fffaf0; }
.bd-vacc-ok { border-color: #9cc79c; background: #f1f9f1; }
.bd-vacc-bad { border-color: #e0a0a0; background: #fdf1f1; }
.bd-vacc-pet { margin-top: 0.45rem; }
.bd-vacc-name { font-weight: 600; }
.bd-vacc-table { width: 100%; border-collapse: collapse; margin-top: 0.15rem; }
.bd-vacc-table td { padding: 0.15rem 0.3rem; border: 0; vertical-align: top; }
.bd-vacc-table td:first-child { width: 1.2rem; }
.bd-vacc-table td:nth-child(2) { white-space: nowrap; }
.bd-vacc-table tr.bad td { color: #7a0000; }

/* Sortable table headings (inventory counts) */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { text-decoration: underline; }
.th-sort { white-space: nowrap; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; }
.th-sort:hover { text-decoration: underline; }

/* "Add items" pop-up: many record lines at once (templates/records/_add_items.html, static/js/add-items.js) */
.ai-launch { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ai-dialog { border: none; border-radius: 10px; padding: 0; width: min(1100px, 96vw); max-height: 92vh;
             box-shadow: 0 10px 36px rgba(0,0,0,0.35); background: var(--cream); color: var(--text); }
.ai-dialog[open] { display: flex; flex-direction: column; }
.ai-dialog::backdrop { background: rgba(0,0,0,0.4); }
.ai-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
           padding: 0.9rem 1.2rem 0.3rem; background: var(--maroon); color: #fff; }
.ai-head h2 { margin: 0 0 0.5rem; font-size: 1.15rem; color: #fff; }
.ai-head .field { margin: 0 0 0.5rem; }
.ai-head label { color: #fff; }
.ai-date input { width: 170px; }
.ai-help { margin: 0.6rem 1.2rem 0.2rem; }
.ai-general { margin: 0.4rem 1.2rem 0; padding: 0.5rem 0.75rem; background: #fde8e6; color: var(--danger); border-radius: 6px; }
.ai-rows { overflow-y: auto; padding: 0.4rem 1.2rem 0.6rem; flex: 1 1 auto; min-height: 400px; } /* room for the pick list under line 1 */
.ai-row { display: flex; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
          padding: 0.4rem 0.75rem 0.2rem; margin-bottom: 0.45rem; }
.ai-row.ai-has-error { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.ai-num { font-weight: 700; color: var(--maroon-dark); padding-top: 1.75rem; min-width: 1.6rem; }
.ai-main { flex: 1; min-width: 0; }
.ai-line1, .ai-line2, .ai-extras { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; }
.ai-line1 .field, .ai-line2 .field, .ai-extras .field { margin-bottom: 0.3rem; }
.ai-item { flex: 1 1 340px; }
.ai-qty { flex: 0 0 90px; }
.ai-qty input { text-align: right; }
.ai-line2 .field { flex: 1 1 300px; }
.ai-line2 textarea { min-height: 2.3rem; resize: vertical; }
.ai-line1 label, .ai-line2 label, .ai-extras .field label { font-size: 0.85rem; margin-bottom: 0.1rem; }
.ai-extras .field { flex: 0 1 200px; }
.ai-extras label.check { margin: 0 0 0.4rem; }
.ai-remove { background: none; border: 1px solid var(--border); border-radius: 6px; font-size: 1.3rem; line-height: 1;
             width: 2.1rem; height: 2.3rem; color: var(--text-muted); cursor: pointer; margin-bottom: 0.3rem; }
.ai-remove:hover { color: var(--danger); border-color: var(--danger); }
.ai-picked { min-height: 1.1em; margin: -0.1rem 0 0.25rem; }
.ai-is-med .ai-label-field label { color: var(--maroon); font-weight: 700; }
.ai-is-med .ai-label-field textarea { border-color: var(--maroon); background: #fffaf0; }
.ai-errors { color: var(--danger); font-size: 0.9rem; }
.ai-errors:empty { display: none; }
.ai-foot { display: flex; gap: 0.6rem; align-items: center; padding: 0.7rem 1.2rem; border-top: 1px solid var(--border); background: #fff8e6; flex-wrap: wrap; }
.ai-spacer { flex: 1; }
.mr-label-text { margin-top: 0.2rem; }
@media (max-width: 640px) {
  .ai-num { display: none; }
  .ai-qty { flex: 0 0 70px; }
}
.ai-x[hidden], .ai-general[hidden] { display: none !important; }
.ai-saved-note { background: #e6f2e9; color: var(--success); border-left: 4px solid var(--success); padding: 0.45rem 0.75rem; border-radius: 6px; margin-bottom: 0.5rem; font-weight: 600; }

/* Communications section on client + patient pages (_communications.html) */
.comms-card { padding: 0.75rem 1rem; }
.comms-h { margin: 0 0 0.5rem; font-size: 1rem; color: var(--maroon-dark); }
.comms-table td { vertical-align: top; }
.comms-when { white-space: nowrap; }
.comms-dir { white-space: nowrap; font-size: 0.85rem; }
.comms-body { white-space: pre-wrap; max-width: 34rem; overflow-wrap: anywhere; }
tr.comms-inbound td { background: #fff7e6; }
tr.comms-blocked td { color: var(--text-muted); }
.comms-problem { color: var(--danger); }
.comms-warn { margin: 0 0 0.6rem; padding: 0.4rem 0.7rem; border-radius: 6px; background: #ffe8b8; color: #8a5a00; }
.comms-foot { margin: 0.5rem 0 0; }
.comms-more { margin-top: 0.5rem; }
@media (max-width: 640px) {
  /* Each row becomes a small stacked card on a phone. */
  .comms-table thead { display: none; }
  .comms-table, .comms-table tbody, .comms-table tr, .comms-table td { display: block; width: auto; }
  .comms-table tr { padding: 0.5rem 0; border-bottom: 1px solid #eadfc6; }
  .comms-table td { padding: 0.1rem 0.4rem; border: none; }
  .comms-table td.comms-when { font-weight: 600; }
  .comms-table td.comms-dir br { display: none; }
  .comms-table td.comms-dir .subtle::before { content: " · "; }
}

/* ezyVet lab results shown as a table (labtext.py, Mike 2026-11-23).
   Prefixed with .mr-comment so the page's own table styles don't win. */
.mr-comment .lab-text { white-space: normal; }
.mr-comment .lab-gap { height: .4em; }
.mr-comment table.lab-table { width: 100%; max-width: 46em; margin: .3em 0 .2em; border-collapse: collapse;
  background: none; border: 0; border-radius: 0; font-size: .9rem; line-height: 1.3; }
.mr-comment table.lab-table th, .mr-comment table.lab-table td { padding: 1px 14px 1px 0; border: 0; border-bottom: 1px solid #f1e6cc;
  background: none; text-align: left; vertical-align: top; font-size: inherit; height: auto; }
.mr-comment table.lab-table th { color: var(--text-muted, #666); font-weight: 600; text-transform: none; letter-spacing: 0;
  border-bottom: 1px solid #d9c9a0; }
.mr-comment table.lab-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mr-comment table.lab-table tr:hover td { background: #fff8ea; }
.mr-comment table.lab-table tr.lab-out td { color: #b00020; font-weight: 600; }
.mr-comment table.lab-table tr.lab-note td { color: inherit; font-weight: normal; white-space: normal; padding: 2px 0 4px; }

/* SOAP note page: heading and text on the same line, like ezyVet (Mike 2026-11-23). */
.soap-line { white-space: pre-wrap; margin: 0 0 0.15rem; }

/* One line per product on the invoice screen (Mike, 2026-11-24): a product
   with parts (service fee, ezyVet bundle) shows its total; staff open it
   with the arrow to see and edit the parts. */
.invoice-lines tr.has-parts:not(.expanded) .x-d,
.invoice-lines tr.has-parts:not(.expanded) .x-dn,
.invoice-lines tr.has-parts.expanded .x-s { display: none; }
.invoice-lines tr.has-parts.expanded td { background: #FFF8E6; }
.invoice-lines tr.part-row td { background: #FFF8E6; }
.invoice-lines tr.part-row:not(.fee-line) td:nth-child(2) { padding-left: 1.6rem; }
.invoice-lines .part-toggle { border: none; background: none; cursor: pointer; padding: 0 0.3rem 0 0; font-size: 1rem;
  color: var(--maroon, #7A0000); line-height: 1; }
.invoice-lines th .parts-all { color: inherit; font-weight: 400; font-size: 0.85em; text-decoration: underline;
  background: none; border: none; cursor: pointer; padding: 0 0 0 0.5rem; }
