/* DrDial clinical components (Batch 11): anatomy chart (av2-), clinical media (cm-), procedure
   flowsheet room pieces (pfs-) and the flowsheet editor (fse-). Uses the theme.css --dd-* tokens. */

:root {
  --av2-skin-hi: #fbf1e8; --av2-skin: #f1dccb; --av2-skin-lo: #dcbca5;
  --av2-detail: rgba(116, 82, 60, .55); --av2-bg: #f7f8fa;
  --av2-region-hover: color-mix(in srgb, var(--accent) 14%, transparent); --av2-region-marked: rgba(232, 89, 12, .22);
  --cm-before: #c9302c; --cm-after: #1f8a4c; --cm-progress: var(--accent); --cm-adverse: #b25e09;
}
html[data-theme="dark"] {
  --av2-skin-hi: #c9b4a4; --av2-skin: #a88f7c; --av2-skin-lo: #7d6656;
  --av2-detail: rgba(40, 24, 14, .6); --av2-bg: #1c1c1e;
}

/* ---------------- Anatomy chart ---------------- */
.av2 { display: flex; flex-direction: column; gap: 10px; }
.av2-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.av2-seg, .av2-zoom { display: inline-flex; background: var(--dd-fill); border-radius: var(--dd-r-sm); padding: 2px; gap: 2px; }
.av2-seg button, .av2-zoom button { border: 0; background: transparent; color: var(--dd-ink-2); min-height: 30px; padding: 0 12px; border-radius: 6px; font: 500 13px var(--dd-font); cursor: pointer; box-shadow: none; }
.av2-seg button.active { background: var(--dd-surface); color: var(--dd-ink); box-shadow: var(--dd-shadow-1); }
.av2-seg button:focus-visible, .av2-zoom button:focus-visible { outline: none; box-shadow: var(--dd-focus); }
.av2-zoom { margin-left: auto; }
.av2-zoom button { min-width: 34px; padding: 0 10px; }
.av2-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: stretch; }
.av2-canvas { position: relative; border: 1px solid var(--dd-line); border-radius: var(--dd-r-lg); background: radial-gradient(circle at 50% 35%, var(--dd-surface) 0, var(--av2-bg) 70%); min-height: 420px; height: min(68vh, 620px); overflow: hidden; touch-action: none; cursor: crosshair; outline: none; }
.av2-canvas:focus-visible { box-shadow: var(--dd-focus); }
.av2-svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.av2-bg { fill: transparent; }
.av2-shadow path { fill: rgba(0, 0, 0, .10); }
.av2-skin path { stroke: rgba(120, 86, 64, .55); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.av2-skin .av2-overlay { stroke-width: 1.2; }
.av2-detail path { fill: none; stroke: var(--av2-detail); stroke-width: 1.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.av2-iris { fill: #8a6d58; opacity: .55; } .av2-pupil { fill: #3a2a20; opacity: .7; }
.av2-regions path { fill: transparent; stroke: transparent; stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill var(--dd-ease); cursor: pointer; }
.av2-regions path.is-hover { fill: var(--av2-region-hover); stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-dasharray: 3 3; }
.av2-regions path.is-marked { fill: var(--av2-region-marked); stroke: rgba(232, 89, 12, .55); }
.av2-regions path.is-focus { stroke: var(--dd-accent); stroke-width: 2; stroke-dasharray: none; }
.av2-mark { cursor: pointer; }
.av2-point circle { fill: var(--accent); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.av2-point .av2-halo { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: none; }
.av2-point .av2-num { fill: #fff; font-weight: 700; text-anchor: middle; font-family: var(--dd-font); pointer-events: none; }
.av2-area circle { fill: #e8590c; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.av2-line line { stroke: #7b2ff7; stroke-linecap: round; } .av2-line circle { fill: #7b2ff7; }
.av2-ghost { stroke: #7b2ff7; stroke-dasharray: 6 4; stroke-linecap: round; }
.av2-mark.is-selected circle:not(.av2-halo) { stroke: #ffcc00; stroke-width: 3; }
.av2-mark.is-selected line { stroke: #ffcc00; }
.av2-hover { position: absolute; left: 12px; top: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(29, 29, 31, .78); color: #fff; font: 600 12px var(--dd-font); pointer-events: none; }
.av2-hover:empty { display: none; }
.av2-hint { position: absolute; left: 12px; bottom: 10px; color: var(--dd-ink-3); font-size: 12px; pointer-events: none; }
.av2-panel { border: 1px solid var(--dd-line); border-radius: var(--dd-r-lg); background: var(--dd-surface); padding: 12px; overflow: auto; max-height: min(68vh, 620px); display: flex; flex-direction: column; gap: 10px; }
.av2-summary { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--dd-line); }
.av2-summary strong { font-size: 15px; color: var(--dd-ink); } .av2-summary span { color: var(--dd-ink-3); font-size: 13px; }
.av2-save { font-style: normal; color: var(--dd-ink-4); font-size: 12px; }
.av2-group h4 { margin: 6px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--dd-ink-3); }
.av2-row { border: 1px solid var(--dd-line); border-radius: var(--dd-r-sm); margin-bottom: 6px; background: var(--dd-surface-2); }
.av2-row.is-open { border-color: var(--dd-accent); box-shadow: var(--dd-focus); }
.av2-row-head { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 10px; text-align: left; color: var(--dd-ink); font: 500 13px var(--dd-font); cursor: pointer; box-shadow: none; min-height: 36px; flex-wrap: wrap; }
.av2-row-head small { width: 100%; color: var(--dd-ink-3); padding-left: 18px; }
.av2-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.av2-row-edit { display: grid; gap: 8px; padding: 0 10px 10px; }
.av2-row-edit label { display: grid; gap: 4px; font-size: 12px; color: var(--dd-ink-3); }
.av2-qty { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 900px) {
  .av2-body { grid-template-columns: 1fr; }
  .av2-canvas { height: 62vh; min-height: 360px; }
  .av2-panel { max-height: none; }
  .av2-zoom { margin-left: 0; }
}

/* ---------------- Clinical media ---------------- */
.cm-page { display: grid; gap: 14px; }
.cm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--dd-surface); border: 1px solid var(--dd-line); border-radius: var(--dd-r-lg); padding: 14px 16px; }
.cm-patient { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 320px; }
.cm-patient small { display: block; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; color: var(--dd-ink-3); }
.cm-patient strong { display: block; font-size: 18px; color: var(--dd-ink); }
.cm-patient span { color: var(--dd-ink-3); font-size: 13px; }
.cm-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--dd-accent-soft); color: var(--dd-accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.cm-actions { display: flex; gap: 8px; }
.cm-picker { display: grid; gap: 6px; width: min(520px, 100%); position: relative; }
.cm-picker label { font-weight: 600; }
.cm-picker-results { display: grid; gap: 4px; }
.cm-picker-results button { display: flex; justify-content: space-between; gap: 12px; text-align: left; border: 1px solid var(--dd-line); background: var(--dd-surface); border-radius: var(--dd-r-sm); padding: 8px 12px; cursor: pointer; box-shadow: none; }
.cm-picker-results button span { color: var(--dd-ink-3); }
.cm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-chips > button, .cm-chip span { border: 1px solid var(--dd-line); background: var(--dd-surface); color: var(--dd-ink-2); border-radius: 999px; padding: 5px 12px; font: 500 13px var(--dd-font); cursor: pointer; box-shadow: none; min-height: 30px; display: inline-flex; align-items: center; }
.cm-chips > button.active, .cm-chip input:checked + span { background: var(--dd-accent); border-color: var(--dd-accent); color: var(--accent-on); }
.cm-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cm-chip { position: relative; }
.cm-chip input:focus-visible + span { box-shadow: var(--dd-focus); }
.cm-session-filter select { min-width: 220px; }
.cm-timeline { display: grid; gap: 18px; }
.cm-day h3 { margin: 0 0 8px; font-size: 14px; color: var(--dd-ink-3); font-weight: 600; }
.cm-session { background: var(--dd-surface); border: 1px solid var(--dd-line); border-radius: var(--dd-r-lg); padding: 12px; margin-bottom: 10px; }
.cm-session-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.cm-session-head span { color: var(--dd-ink-3); font-size: 13px; }
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cm-tile { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--dd-line); border-radius: var(--dd-r); background: var(--dd-fill); overflow: hidden; padding: 0; cursor: pointer; display: grid; place-items: center; box-shadow: none; }
.cm-tile.skeleton { animation: cmPulse 1.2s ease-in-out infinite; cursor: default; }
@keyframes cmPulse { 50% { opacity: .55; } }
.cm-tile canvas { max-width: 100%; max-height: 100%; opacity: 0; transition: opacity 200ms; }
.cm-tile.is-loaded canvas { opacity: 1; }
.cm-tile.is-error::after { content: "Unavailable"; color: var(--dd-ink-3); font-size: 12px; }
.cm-tile:hover { border-color: var(--dd-line-strong); }
.cm-tile:focus-visible { outline: none; box-shadow: var(--dd-focus); }
.cm-tile.is-selected { border: 2px solid var(--dd-accent); box-shadow: var(--dd-focus); }
.cm-tag { position: absolute; left: 6px; top: 6px; color: #fff; font: 700 11px var(--dd-font); padding: 2px 8px; border-radius: 999px; background: var(--cm-progress); text-transform: uppercase; letter-spacing: .03em; }
.cm-info .cm-tag, figcaption .cm-tag { position: static; display: inline-block; }
.cm-tag-before { background: var(--cm-before); } .cm-tag-after { background: var(--cm-after); } .cm-tag-adverse_event { background: var(--cm-adverse); }
.cm-angle { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.cm-ann { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.cm-sel { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--dd-accent); color: var(--accent-on); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.cm-page.is-selecting .cm-tile:not(.is-selected) canvas { filter: saturate(.85); }
.cm-empty { background: var(--dd-surface); border: 1px dashed var(--dd-line-strong); border-radius: var(--dd-r-lg); padding: 36px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.cm-empty p { max-width: 520px; margin: 0; }
.cm-empty-icon { font-size: 28px; color: var(--dd-accent); }
.cm-compare-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--dd-ink); color: #fff; border-radius: var(--dd-r-lg); padding: 10px 14px; box-shadow: var(--dd-shadow-pop); }
.cm-compare-bar div { display: flex; gap: 8px; }
.cm-compare-bar .ghost-pill { color: #fff; border-color: rgba(255, 255, 255, .4); background: transparent; }

.cm-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(12, 12, 14, .94); display: flex; flex-direction: column; color: #fff; }
.cm-overlay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.cm-overlay-bar > strong { font-size: 15px; }
.cm-overlay-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; justify-content: flex-end; }
.cm-overlay-tools button, .cm-overlay-tools select { min-height: 32px; border-radius: var(--dd-r-sm); border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; padding: 0 10px; font: 500 13px var(--dd-font); cursor: pointer; box-shadow: none; }
.cm-overlay-tools button.active { background: var(--dd-accent); border-color: var(--dd-accent); }
.cm-overlay-tools label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.cm-close { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; box-shadow: none; }
.cm-overlay-body { flex: 1; min-height: 0; display: flex; }
.cm-seg { display: inline-flex; border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--dd-r-sm); overflow: hidden; }
.cm-seg button { border: 0 !important; border-radius: 0 !important; }
.cm-colors { display: inline-flex; gap: 4px; }
.cm-colors button { width: 24px; min-height: 24px !important; height: 24px; padding: 0 !important; border-radius: 50% !important; background: var(--c) !important; border: 2px solid rgba(255, 255, 255, .3) !important; }
.cm-colors button.active { border-color: #fff !important; box-shadow: 0 0 0 2px var(--dd-accent); }
.cm-text-input { min-height: 32px; border-radius: var(--dd-r-sm); border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); color: #fff; padding: 0 10px; width: 200px; }
.cm-viewer { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.cm-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 12px 48px; }
.cm-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 64px; border: 0; border-radius: var(--dd-r); background: rgba(255, 255, 255, .1); color: #fff; font-size: 28px; cursor: pointer; box-shadow: none; }
.cm-nav:disabled { opacity: .25; cursor: default; }
.cm-prev { left: 6px; } .cm-next { right: 6px; }
.cm-info { background: rgba(255, 255, 255, .04); border-left: 1px solid rgba(255, 255, 255, .08); padding: 16px; overflow: auto; display: grid; align-content: start; gap: 12px; }
.cm-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.cm-info dt { color: rgba(255, 255, 255, .6); } .cm-info dd { margin: 0; }
.cm-info-actions { display: grid; gap: 6px; }
.cm-info-actions button { min-height: 36px; border-radius: var(--dd-r-sm); border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; box-shadow: none; }
.cm-info-actions button.active { background: var(--dd-accent); border-color: var(--dd-accent); }
.cm-info-actions .danger-soft { color: #ff8a80; }
.cm-info .muted, .cm-overlay .muted { color: rgba(255, 255, 255, .6); }
.cm-loading { color: rgba(255, 255, 255, .6); }
.cm-compare { flex: 1; display: grid; gap: 8px; padding: 10px; min-height: 0; position: relative; touch-action: none; }
.cm-compare[data-mode="side"], .cm-compare[data-count="2"][data-mode="side"] { grid-template-columns: 1fr 1fr; }
.cm-compare[data-mode="grid"][data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.cm-compare[data-mode="grid"][data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cm-pane { margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; background: rgba(255, 255, 255, .03); border-radius: var(--dd-r); overflow: hidden; }
.cm-pane-canvas { display: grid; place-items: center; overflow: hidden; min-height: 0; }
.cm-pane-canvas canvas { transform-origin: center; transition: transform 60ms linear; }
.cm-pane figcaption { padding: 6px 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cm-compare[data-mode="slider"] { grid-template-columns: 1fr; }
.cm-compare[data-mode="slider"] .cm-pane { grid-area: 1 / 1; }
.cm-compare[data-mode="slider"] .cm-pane[data-i="1"] { clip-path: inset(0 0 0 var(--cm-reveal, 50%)); }
.cm-compare[data-mode="slider"] .cm-pane[data-i="1"] figcaption { justify-content: flex-end; }
.cm-slider { display: none; }
.cm-compare[data-mode="slider"] .cm-slider { display: block; position: absolute; left: 10px; right: 10px; bottom: 44px; width: calc(100% - 20px); z-index: 2; }
.cm-annotate { flex: 1; display: flex; min-height: 0; }
.cm-annotate-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 8px; }
.cm-annotate-stage canvas { touch-action: none; cursor: crosshair; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.cm-overlay-sheet { background: rgba(12, 12, 14, .6); align-items: center; justify-content: center; }
.cm-overlay-sheet .cm-overlay-bar { width: min(640px, 100%); background: var(--dd-surface); color: var(--dd-ink); border-radius: var(--dd-r-lg) var(--dd-r-lg) 0 0; border-bottom: 1px solid var(--dd-line); }
.cm-overlay-sheet .cm-close { background: var(--dd-fill); color: var(--dd-ink); }
.cm-overlay-sheet .cm-overlay-body { flex: none; width: min(640px, 100%); max-height: calc(100vh - 120px); overflow: auto; background: var(--dd-surface); color: var(--dd-ink); border-radius: 0 0 var(--dd-r-lg) var(--dd-r-lg); }
.cm-form { display: grid; gap: 14px; padding: 16px; width: 100%; }
.cm-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.cm-form legend { font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.cm-form label { display: grid; gap: 4px; font-size: 13px; color: var(--dd-ink-2); }
.cm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cm-form-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: var(--dd-surface); padding-top: 8px; }
.cm-drop { border: 1.5px dashed var(--dd-line-strong); border-radius: var(--dd-r-lg); padding: 18px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.cm-drop.is-over { border-color: var(--dd-accent); background: var(--dd-accent-soft); }
.cm-drop p { margin: 0; }
.cm-drop-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cm-file-btn { display: inline-flex !important; align-items: center; min-height: 38px; padding: 0 16px; border-radius: var(--dd-r-sm); border: 1px solid var(--dd-line-strong); background: var(--dd-surface); color: var(--dd-ink) !important; font-weight: 600; cursor: pointer; }
.cm-file-btn.active { background: var(--dd-accent); border-color: var(--dd-accent); color: var(--accent-on) !important; }
.cm-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cm-queue li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 6px; }
.cm-queue img, .cm-q-icon { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--dd-fill); display: grid; place-items: center; font-size: 11px; color: var(--dd-ink-3); }
.cm-queue li div { display: grid; gap: 2px; min-width: 0; }
.cm-queue li strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-queue li span, .cm-queue li em { font-size: 12px; color: var(--dd-ink-3); font-style: normal; }
.cm-queue progress { width: 100%; height: 6px; }
.cm-queue li.is-done { border-color: var(--dd-success); } .cm-queue li.is-done em { color: var(--dd-success); }
.cm-queue li.is-error { border-color: var(--dd-danger); } .cm-queue li.is-error em { color: var(--dd-danger); }
.cm-queue button { border: 0; background: transparent; cursor: pointer; color: var(--dd-ink-3); box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) {
  .cm-viewer { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .cm-info { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); max-height: 40vh; }
  .cm-compare[data-mode="side"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .cm-compare[data-mode="grid"][data-count="3"] { grid-template-columns: 1fr 1fr; }
  .cm-form-row { grid-template-columns: 1fr; }
  .cm-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .cm-overlay-tools { justify-content: flex-start; }
  .cm-overlay-sheet .cm-overlay-body { max-height: calc(100vh - 64px); }
  .cm-overlay-sheet { justify-content: flex-end; }
}

/* ---------------- Procedure room: flowsheet pieces ---------------- */
.pfs-source { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--dd-ink-3); }
.pfs-source a, .pfs-source button { font-size: 12px; }
.pfs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.pfs-chips button { border: 1px solid var(--dd-line); background: var(--dd-surface); color: var(--dd-ink-2); border-radius: 999px; min-height: 30px; padding: 0 12px; font: 500 13px var(--dd-font); cursor: pointer; box-shadow: none; }
.pfs-chips button.active { background: var(--dd-accent-soft); border-color: var(--dd-accent); color: var(--dd-accent); }
.pfs-session { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.pfs-tile { border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 10px 12px; background: var(--dd-surface-2); display: grid; gap: 2px; }
.pfs-tile small { color: var(--dd-ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.pfs-tile strong { font-size: 15px; color: var(--dd-ink); }
.pfs-tile span { color: var(--dd-ink-3); font-size: 12px; }
.pfs-tile.is-package { border-color: var(--dd-accent); background: var(--dd-accent-soft); }
.pfs-tile.is-warn { border-color: var(--dd-warning); background: var(--dd-warning-soft); }
.pfs-progress { display: flex; gap: 3px; margin-top: 4px; }
.pfs-progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--dd-fill-strong); }
.pfs-progress i.done { background: var(--dd-success); } .pfs-progress i.today { background: var(--dd-accent); }
.pfs-checklist { display: grid; gap: 6px; margin: 8px 0; }
.pfs-check { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--dd-line); border-radius: var(--dd-r-sm); padding: 9px 12px; background: var(--dd-surface); cursor: pointer; font-size: 14px; }
.pfs-check input { margin-top: 2px; width: 18px; height: 18px; flex: none; }
.pfs-check:has(input:checked) { border-color: var(--dd-success); background: var(--dd-success-soft); }
.pfs-check em { font-style: normal; color: var(--dd-ink-4); font-size: 12px; margin-left: auto; }
.pfs-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 12px; }
.pfs-param { display: grid; gap: 4px; font-size: 13px; color: var(--dd-ink-2); }
.pfs-param .pfs-input { display: flex; align-items: center; border: 1px solid var(--dd-line-strong); border-radius: var(--dd-r-sm); background: var(--dd-surface); overflow: hidden; }
.pfs-param .pfs-input:focus-within { border-color: var(--dd-accent); box-shadow: var(--dd-focus); }
.pfs-param .pfs-input input, .pfs-param .pfs-input select { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; background: transparent; }
.pfs-param .pfs-unit { padding: 0 10px; color: var(--dd-ink-3); font-size: 12px; white-space: nowrap; }
.pfs-param small { color: var(--dd-ink-3); font-size: 11px; }
.pfs-param small.is-warn { color: var(--dd-warning); }
.pfs-param.is-required > span::after { content: " *"; color: var(--dd-danger); }
.pfs-last { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; background: var(--dd-accent-soft); border-radius: var(--dd-r); padding: 8px 12px; font-size: 13px; color: var(--dd-ink-2); margin-bottom: 10px; }
.pfs-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pfs-photo-col h4 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.pfs-angles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pfs-angle { position: relative; aspect-ratio: 3 / 4; border: 1.5px dashed var(--dd-line-strong); border-radius: var(--dd-r); background: var(--dd-surface-2); display: grid; place-items: center; text-align: center; cursor: pointer; overflow: hidden; padding: 6px; font-size: 12px; color: var(--dd-ink-3); }
.pfs-angle:hover { border-color: var(--dd-accent); color: var(--dd-accent); }
.pfs-angle.has-photo { border-style: solid; border-color: var(--dd-success); padding: 0; }
.pfs-angle canvas { max-width: 100%; max-height: 100%; }
.pfs-angle .pfs-angle-label { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 5px; padding: 1px 6px; font-size: 11px; }
.pfs-angle progress { position: absolute; left: 6px; right: 6px; bottom: 6px; width: calc(100% - 12px); height: 5px; }
.pfs-angle input { display: none; }
.pfs-more { border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 0 12px; background: var(--dd-surface); }
.pfs-more summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 13px; color: var(--dd-ink-2); }
.pfs-more[open] { padding-bottom: 12px; }
.pfs-defaulted { font-size: 12px; color: var(--dd-ink-3); }
@media (max-width: 760px) { .pfs-photos { grid-template-columns: 1fr; } }

/* ---------------- Flowsheet editor (Settings → Services) ---------------- */
.fse { display: grid; gap: 14px; }
.fse-preset { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; background: var(--dd-accent-soft); padding: 10px 12px; border-radius: var(--dd-r); }
.fse-preset label { flex: 1 1 220px; }
.fse-section { border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 12px; display: grid; gap: 8px; background: var(--dd-surface); }
.fse-section h4 { margin: 0; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.fse-section p.muted { margin: 0; font-size: 12px; }
.fse-row { display: grid; gap: 6px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto; align-items: center; }
.fse-row.param { grid-template-columns: minmax(0, 2fr) 110px 80px minmax(0, 2fr) auto auto; }
.fse-row.cons { grid-template-columns: minmax(0, 2fr) 90px 90px auto; }
.fse-row label.check { white-space: nowrap; font-size: 12px; }
.fse-row button.fse-del { border: 0; background: transparent; color: var(--dd-ink-3); cursor: pointer; min-height: 30px; box-shadow: none; }
.fse-add { justify-self: start; }
.fse-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 760px) {
  .fse-row, .fse-row.param, .fse-row.cons { grid-template-columns: 1fr 1fr; }
  .fse-grid2 { grid-template-columns: 1fr; }
}

/* Procedure room: six steps; checklist rows are horizontal (legacy form labels are grids). */
html body.aesthetic-crm .procedure-room .proc-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
html body.aesthetic-crm .procedure-room label.pfs-check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; font-weight: 500; color: var(--dd-ink); }
html body.aesthetic-crm .procedure-room label.pfs-check input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; }
html body.aesthetic-crm .procedure-room .pfs-subhead { margin: 14px 0 4px; font-size: 13px; color: var(--dd-ink-2); }
html body.aesthetic-crm .procedure-room .pfs-checklist + .pfs-checklist { margin-top: 0; }
html body.aesthetic-crm .procedure-room label.pfs-angle { display: grid; }
html body.aesthetic-crm .procedure-room label.pfs-param { margin: 0; }
html body.aesthetic-crm .procedure-room .pfs-next { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.proc-done-list { margin: 8px 0 14px; padding-left: 18px; display: grid; gap: 6px; }

/* Segmented controls inside the clinical components win over the global theme button style. */
html body.aesthetic-crm .av2-seg button, html body.aesthetic-crm .av2-zoom button { border: 0; background: transparent; box-shadow: none; min-height: 30px; border-radius: 6px; color: var(--dd-ink-2); }
html body.aesthetic-crm .av2-seg button:hover, html body.aesthetic-crm .av2-zoom button:hover { background: rgba(0, 0, 0, .04); }
html body.aesthetic-crm .av2-seg button.active { background: var(--dd-surface); color: var(--dd-ink); box-shadow: var(--dd-shadow-1); }
html body.aesthetic-crm .procedure-room .procedure-section.av2.active, html body.aesthetic-crm .av2 { display: flex; flex-direction: column; gap: 10px; }
html body.aesthetic-crm .av2-row-head, html body.aesthetic-crm .av2-row-head:hover { border: 0; background: transparent; box-shadow: none; }
html body.aesthetic-crm .pfs-chips button { border-radius: 999px; }
html body.aesthetic-crm .pfs-chips button.active { background: var(--dd-accent-soft); border-color: var(--dd-accent); color: var(--dd-accent); }
html body.aesthetic-crm .cm-chips > button { border-radius: 999px; }
html body.aesthetic-crm .cm-chips > button.active { background: var(--dd-accent); border-color: var(--dd-accent); color: var(--accent-on); }
html body.aesthetic-crm .cm-tile, html body.aesthetic-crm .cm-tile:hover { padding: 0; background: var(--dd-fill); box-shadow: none; }
html body.aesthetic-crm .cm-overlay button { box-shadow: none; }
html body.aesthetic-crm .cm-overlay-tools button, html body.aesthetic-crm .cm-info-actions button { min-height: 32px; border-radius: var(--dd-r-sm); border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; padding: 0 10px; }
html body.aesthetic-crm .cm-overlay-tools button:hover, html body.aesthetic-crm .cm-info-actions button:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
html body.aesthetic-crm .cm-overlay-tools button.active, html body.aesthetic-crm .cm-info-actions button.active { background: var(--dd-accent); border-color: var(--dd-accent); color: var(--accent-on); }
html body.aesthetic-crm .cm-info-actions .danger-soft { color: #ff8a80; }
html body.aesthetic-crm .cm-overlay-tools .cm-colors button { width: 24px; height: 24px; min-height: 24px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .3); }
html body.aesthetic-crm .cm-overlay-tools .cm-colors button.active { border-color: #fff; box-shadow: 0 0 0 2px var(--dd-accent); }
html body.aesthetic-crm .cm-overlay-tools .cm-seg button { border: 0; border-radius: 0; }
html body.aesthetic-crm .cm-close, html body.aesthetic-crm .cm-close:hover { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
html body.aesthetic-crm .cm-overlay-sheet .cm-close { background: var(--dd-fill); color: var(--dd-ink); }
html body.aesthetic-crm .cm-nav, html body.aesthetic-crm .cm-nav:hover { border: 0; background: rgba(255, 255, 255, .1); color: #fff; width: 40px; height: 64px; padding: 0; font-size: 28px; }
html body.aesthetic-crm .cm-compare-bar .ghost-pill { color: #fff; border-color: rgba(255, 255, 255, .4); background: transparent; }
html body.aesthetic-crm .cm-queue button { border: 0; background: transparent; box-shadow: none; }
html body.aesthetic-crm .fse-row button.fse-del { border: 0; background: transparent; box-shadow: none; }
html body.aesthetic-crm .av2-row-head, html body.aesthetic-crm .av2-row-head:hover { justify-content: flex-start; text-align: left; width: 100%; min-height: 36px; padding: 8px 10px; color: var(--dd-ink); font-weight: 500; }
html body.aesthetic-crm .procedure-room .pfs-checklist { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
html body.aesthetic-crm .procedure-room label.pfs-check { padding: 8px 12px; font-size: 13.5px; }
/* hidden must win over the component display rules */
.cm-page [hidden], .cm-overlay [hidden], .procedure-room [hidden], .av2 [hidden], .fse [hidden] { display: none !important; }
html body.aesthetic-crm .cm-overlay { background: #0d0d0f; }
html body.aesthetic-crm .cm-overlay.cm-overlay-sheet { background: rgba(12, 12, 14, .55); backdrop-filter: blur(2px); }
html body.aesthetic-crm .cm-overlay-tools select, html body.aesthetic-crm .cm-overlay-tools input[type="text"] { width: auto; min-width: 0; flex: 0 0 auto; }
html body.aesthetic-crm .cm-overlay-tools input[type="range"] { width: 140px; }
html body.aesthetic-crm .cm-overlay-tools select { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .2); }
html body.aesthetic-crm .cm-overlay-tools select option { color: #1d1d1f; }

/* ---------------- Consultation: layout + speed tools ---------------- */
@media (min-width: 900px) {
  html body.aesthetic-crm .cw-card[data-card="assessment"] { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
html body.aesthetic-crm .cw-card[data-card="assessment"] .cw-field { display: grid; gap: 8px; align-content: start; min-width: 0; }
html body.aesthetic-crm .cw-card[data-card="assessment"] .cw-wide { grid-column: 1 / -1; }
html body.aesthetic-crm .cw-card .cw-chipgroup { display: flex; flex-wrap: wrap; gap: 6px; }
html body.aesthetic-crm .cw-card .cw-chipbtn { min-height: 28px !important; padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
.cw-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cw-copy-list, .cw-template-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
html body.aesthetic-crm label.cw-copy-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--dd-line); border-radius: var(--dd-r-sm); padding: 8px 10px; font-weight: 400; }
.cw-copy-row span { display: grid; gap: 2px; } .cw-copy-row small { color: var(--dd-ink-3); }
.cw-template { display: flex; gap: 8px; align-items: center; border: 1px solid var(--dd-line); border-radius: var(--dd-r-sm); padding: 6px 8px; }
html body.aesthetic-crm .cw-template-apply { flex: 1; display: grid; gap: 2px; text-align: left; justify-items: start; border: 0; background: transparent; box-shadow: none; min-height: 40px; }
.cw-template-apply small { color: var(--dd-ink-3); font-weight: 400; }

/* ---------------- Treatment plan form ---------------- */
.plan-form .plan-suggested { background: var(--dd-accent-soft); border-radius: var(--dd-r); padding: 10px 12px; display: grid; gap: 6px; font-size: 13px; }
.plan-form .plan-numbers { align-items: end; }
.plan-form .plan-every { display: flex; gap: 6px; } .plan-form .plan-every input { width: 70px; flex: none; }
html body.aesthetic-crm .plan-form label.plan-consent { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.plan-form .plan-doc { border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 0 12px; }
.plan-form .plan-doc summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.plan-form .plan-doc[open] { padding-bottom: 12px; display: grid; gap: 8px; }
.plan-form .form-grid.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .plan-form .form-grid.three { grid-template-columns: 1fr 1fr; } }

/* ---------------- Prescription speed tools ---------------- */
.rx-speed { display: grid; gap: 8px; background: var(--dd-surface-2); border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 10px 12px; margin-bottom: 10px; }
.rx-speed > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rx-speed span, .rx-quick span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dd-ink-3); margin-right: 4px; }
html body.aesthetic-crm .rx-speed button:not(.link-btn), html body.aesthetic-crm .rx-quick button { min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; }
.rx-quick { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 6px 0 2px; }
html body.aesthetic-crm .rx-quick button.active { background: var(--dd-accent-soft); border-color: var(--dd-accent); color: var(--dd-accent); }
.rx-protocol-hint { display: block; margin-top: 4px; }
html body.aesthetic-crm .plan-form .plan-option-cards { display: flex; flex-wrap: wrap; gap: 8px; }
html body.aesthetic-crm .plan-form .plan-option-card { display: grid; gap: 2px; justify-items: start; text-align: left; width: auto; max-width: 100%; min-height: 44px; padding: 6px 12px; white-space: normal; }
html body.aesthetic-crm .plan-form .plan-option-card strong { font-size: 13px; overflow-wrap: anywhere; }
html body.aesthetic-crm .plan-form .plan-option-card small { color: var(--dd-ink-3); font-size: 12px; }
html body.aesthetic-crm .plan-form .plan-option-card.selected { border-color: var(--dd-accent); background: var(--dd-accent-soft); }

/* Tablet (769–1199 px): the shell column is 72 px (icon rail); the theme's sidebar width must follow
   or the sidebar covers the first ~160 px of every page (pre-existing overlap). */
@media (min-width: 769px) and (max-width: 1199px) {
  html body.aesthetic-crm .medical-sidebar, html body.aesthetic-crm .medical-sidebar.collapsed { width: 72px; min-width: 0; overflow-x: hidden; }
  html body.aesthetic-crm .medical-sidebar .brand-lockup small, html body.aesthetic-crm .medical-sidebar .brand-lockup strong { display: none; }
}

/* ---- Batch 11.1: anatomy refinement ---- */
.av2-fills .av2-eyewhite { fill: #fff; opacity: .92; }
.av2-fills .av2-lips { fill: #c97b74; opacity: .5; }
.av2-fills .av2-brow { fill: #6b4a36; opacity: .45; }
.av2-label { fill: var(--dd-ink); stroke: #fff; paint-order: stroke; stroke-linejoin: round; font-weight: 650; font-family: var(--dd-font); pointer-events: none; }
.av2-label-sel { fill: var(--dd-accent); text-anchor: middle; }
html[data-theme="dark"] .av2-label { stroke: #1c1c1e; fill: #f2f2f7; }
.av2-group h4 { display: flex; justify-content: space-between; gap: 8px; }
.av2-group h4 span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dd-ink-3); }
.av2-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.av2-row .av2-row-edit { grid-column: 1 / -1; }
html body.aesthetic-crm .av2-x { border: 0; background: transparent; box-shadow: none; color: var(--dd-ink-3); min-height: 36px; width: 32px; padding: 0; font-size: 18px; }
html body.aesthetic-crm .av2-x:hover { color: var(--dd-danger); background: transparent; }
html body.aesthetic-crm .av2-zoom button[data-undo]:disabled { opacity: .35; }
.av2-canvas { cursor: crosshair; }
.av2-mark.is-selected.av2-point { cursor: grab; }
@media (max-width: 640px) {
  .av2-toolbar { gap: 6px; }
  .av2-seg button, .av2-zoom button { padding: 0 9px; font-size: 12.5px; }
  .av2-canvas { height: 56vh; min-height: 320px; }
}
/* ---- Procedure: step status + completion sheet ---- */
html body.aesthetic-crm .procedure-room .proc-steps button.is-missing em { background: var(--dd-warning-soft); color: var(--dd-warning); box-shadow: inset 0 0 0 1px var(--dd-warning); }
html body.aesthetic-crm .procedure-room .proc-steps button.is-done:not(.active) em { background: var(--dd-success-soft); color: var(--dd-success); }
#procedureSaveState .link-btn { font-size: inherit; }
.proc-check-list { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 6px; }
.proc-check-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--dd-line); border-radius: var(--dd-r-sm); padding: 8px 12px; }
.proc-check-list li span::before { content: "•"; color: var(--dd-warning); margin-right: 8px; }

/* ---------------- Patients: packages view, delete ---------------- */
.pkg-table { display: grid; gap: 0; }
.pkg-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(140px, 1.2fr) minmax(110px, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--dd-line); }
.pkg-row .cell-link { display: flex; gap: 10px; align-items: center; text-align: left; min-width: 0; }
.pkg-row span small { display: block; color: var(--dd-ink-3); font-size: 12px; }
.pkg-row .pkg-sessions .pfs-progress { max-width: 160px; }
.pkg-tabs { margin: 4px 0 10px; }
.delete-patient-explain { background: var(--dd-warning-soft); border-radius: var(--dd-r); padding: 10px 14px; }
.delete-patient-explain.is-delete { background: var(--dd-danger-soft); }
.delete-patient-explain ul { margin: 6px 0 0; padding-left: 18px; }
html body.aesthetic-crm button.danger { background: var(--dd-danger); border-color: var(--dd-danger); color: #fff; }
html body.aesthetic-crm button.danger:disabled { opacity: .45; }
@media (max-width: 760px) { .pkg-row { grid-template-columns: 1fr auto; } .pkg-row > span:nth-child(3), .pkg-row > span:nth-child(4) { display: none; } }

/* ---------------- Walk-in + appointment patient chip ---------------- */
.walkin-form .walkin-step { display: grid; gap: 8px; }
.walkin-form .walkin-step h4 { margin: 4px 0 0; font-size: 13px; color: var(--dd-ink-2); }
.walkin-actions { justify-content: flex-end; }
.patient-chip-selected { display: flex; align-items: center; gap: 10px; border: 1px solid var(--dd-accent); background: var(--dd-accent-soft); border-radius: var(--dd-r); padding: 8px 12px; }
.patient-chip-selected > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.patient-chip-selected small { color: var(--dd-ink-3); }
.patient-chip-selected .ui-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--dd-surface); font-weight: 700; color: var(--dd-accent); }
#aesAppointmentForm [data-booking-step="1"].has-patient .patient-typeahead,
#aesAppointmentForm [data-booking-step="1"].has-patient .form-grid.two { display: none; }
#apptPatientChip { margin: 6px 0; }

/* ---------------- Consultation: next steps tiles ---------------- */
.cw-nextsteps .cw-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.cw-tile { display: grid; gap: 8px; align-content: space-between; border: 1px solid var(--dd-line); border-radius: var(--dd-r); padding: 10px 12px; background: var(--dd-surface-2); }
.cw-tile > div { display: grid; gap: 2px; }
.cw-tile strong { font-size: 14px; }
.cw-tile span { font-size: 12px; color: var(--dd-ink-3); }
.cw-tile button { justify-self: start; }
.cw-tile.needs-action { border-color: var(--dd-warning); background: var(--dd-warning-soft); }
.cw-nextsteps .cw-followup { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--dd-line); }
.cw-followup-label { font-weight: 600; font-size: 13px; align-self: center; }

/* ---------------- Consultation suggestions ---------------- */
.cs-suggest-wrap { position: relative; }
.cs-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--dd-surface); border: 1px solid var(--dd-line-strong); border-radius: var(--dd-r); box-shadow: var(--dd-shadow-pop); padding: 4px; display: grid; gap: 2px; max-height: 280px; overflow: auto; }
html body.aesthetic-crm .cs-suggest button { display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: transparent; box-shadow: none; min-height: 32px; padding: 0 10px; border-radius: 6px; font: 500 13px var(--dd-font); color: var(--dd-ink); }
html body.aesthetic-crm .cs-suggest button:hover, html body.aesthetic-crm .cs-suggest button.is-active { background: var(--dd-accent-soft); color: var(--dd-accent); }
.cs-suggest small { color: var(--dd-ink-4); font-weight: 400; }
html body.aesthetic-crm .cw-headcard .cw-doctor.is-locked { display: none; }
.av2-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.av2-quick:empty { display: none; }
.av2-quick > span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dd-ink-3); margin-right: 2px; }
html body.aesthetic-crm .av2-quick button { min-height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; }
html body.aesthetic-crm .av2-quick button.active { background: #fdeee4; border-color: #e8590c; color: #b5410a; }
.walkin-form [hidden], #aesAppointmentForm [hidden] { display: none !important; }
.perm-cell-group { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ---------------- B11.3: consultation quick picks + next actions ---------------- */
html body.aesthetic-crm .cw-card .cw-chipgroup { align-items: center; margin-top: 6px; }
.cw-chip-hint { font-size: 11px; color: var(--dd-ink-3); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
html body.aesthetic-crm .cw-card .cw-chipgroup:empty { display: none; }
.cw-actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
html body.aesthetic-crm button.cw-action { display: grid; grid-template-rows: auto auto 1fr; justify-items: start; align-content: start; gap: 2px; min-height: 92px; height: auto; padding: 12px; text-align: left; border: 1px solid var(--dd-line); border-radius: var(--dd-r); background: var(--dd-surface); color: var(--dd-ink); white-space: normal; box-shadow: none; }
html body.aesthetic-crm button.cw-action:hover:not(:disabled) { border-color: var(--dd-accent); background: var(--dd-accent-soft); }
html body.aesthetic-crm button.cw-action:disabled { opacity: .5; }
.cw-action i { font-style: normal; font-size: 13px; font-weight: 700; color: var(--dd-accent); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--dd-accent-soft); margin-bottom: 6px; }
.cw-action strong { font-size: 14px; font-weight: 600; }
.cw-action span { font-size: 12px; color: var(--dd-ink-3); line-height: 1.3; }
html body.aesthetic-crm button.cw-action.is-ready { border-color: var(--dd-accent); }
html body.aesthetic-crm button.cw-action.is-finish { background: var(--dd-accent); border-color: var(--dd-accent); color: var(--accent-on); }
html body.aesthetic-crm button.cw-action.is-finish i { background: rgba(255,255,255,.18); color: #fff; }
html body.aesthetic-crm button.cw-action.is-finish span { color: rgba(255,255,255,.85); }
html body.aesthetic-crm button.cw-action.is-finish:hover:not(:disabled) { filter: brightness(1.06); background: var(--dd-accent); }
.cw-consent-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 8px 12px; border-radius: var(--dd-r-sm); background: var(--dd-fill); font-size: 13px; }
.cw-consent-strip.needs-action { background: var(--dd-warning-soft); }
.cw-consent-strip[hidden] { display: none; }
@media (max-width: 1100px) { .cw-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cw-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } html body.aesthetic-crm button.cw-action { min-height: 80px; } html body.aesthetic-crm button.cw-action.is-finish { grid-column: 1 / -1; } .cw-consent-strip { flex-wrap: wrap; } }
html body.aesthetic-crm button.cw-action.is-finish.is-blocked { background: var(--dd-surface); border-color: var(--dd-line); color: var(--dd-ink); }
html body.aesthetic-crm button.cw-action.is-finish.is-blocked i { background: var(--dd-fill); color: var(--dd-ink-3); }
html body.aesthetic-crm button.cw-action.is-finish.is-blocked span { color: var(--dd-ink-3); }

/* ---------------- B11.3: packages table ---------------- */
.pkg-scope { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; border-radius: var(--dd-r-sm); background: var(--dd-accent-soft); font-size: 13px; }
.pkg-grid { display: grid; border: 1px solid var(--dd-line); border-radius: var(--dd-r); overflow: hidden; background: var(--dd-surface); }
.pkg-grid-row { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(170px, 1.6fr) 56px 56px 56px minmax(100px, .8fr) 130px 120px; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--dd-line); font-size: 13px; }
.pkg-grid-row:first-child { border-top: 0; }
.pkg-grid-head { background: var(--dd-fill); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--dd-ink-3); padding-top: 7px; padding-bottom: 7px; }
.pkg-grid-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.pkg-grid-row .pkg-left strong { color: var(--dd-accent); font-size: 15px; }
html body.aesthetic-crm .pkg-grid-row .pkg-patient { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; box-shadow: none; text-align: left; height: auto; min-height: 0; }
.pkg-grid-row .pkg-patient strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-grid-row .pkg-name { display: grid; gap: 4px; min-width: 0; }
.pkg-grid-row .pkg-name strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-grid-row .pfs-progress { max-width: 150px; }
.pkg-grid-row .pkg-soon { color: var(--dd-warning); font-weight: 600; }
.pkg-grid-row .pkg-act { justify-self: end; }
@media (max-width: 900px) {
  .pkg-grid-head { display: none; }
  .pkg-grid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
  html body.aesthetic-crm .pkg-grid-row .pkg-patient { flex: 1 1 0; min-width: 0; }
  .pkg-grid-row .pkg-act { order: 1; flex: 0 0 auto; }
  .pkg-grid-row .pkg-name { order: 2; flex: 1 1 100%; }
  .pkg-grid-row > [data-label], .pkg-grid-row > span:nth-child(7) { order: 3; display: inline-flex; gap: 4px; white-space: nowrap; text-align: left; font-size: 12px; }
  .pkg-grid-row > [data-label]::before { content: attr(data-label) ":"; color: var(--dd-ink-3); }
}

/* ---------------- B11.3: booking patient bar, walk-in ---------------- */
.booking-patient-bar { margin: 4px 0 10px; }
.booking-patient-bar[hidden] { display: none; }
.booking-patient-bar .patient-chip-selected { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--dd-line); border-radius: var(--dd-r); background: var(--dd-surface-2); }
.booking-patient-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--dd-ink-3); }
.booking-patient-bar .patient-chip-selected > span:nth-child(3) { flex: 1 1 auto; display: grid; }
.booking-patient-bar .patient-chip-selected small { color: var(--dd-ink-3); }
.walkin-hint { font-size: 12px; margin: 0; }
.walkin-actions { justify-content: flex-end; }
html body.aesthetic-crm .smart-booking-form:has(> .booking-patient-bar:not([hidden])) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
html body.aesthetic-crm .smart-booking-form > .booking-patient-bar { margin: 10px 6px 0; }
html body.aesthetic-crm .av2-clear { justify-self: start; margin-top: 6px; min-height: 26px; padding: 0 10px; font-size: 12px; border: 1px solid var(--dd-line); background: var(--dd-surface); color: var(--dd-ink-2); border-radius: var(--dd-r-sm); box-shadow: none; }
html body.aesthetic-crm .av2-clear.is-armed { border-color: var(--dd-danger); color: var(--dd-danger); background: var(--dd-danger-soft); }
.cw-summary > div.is-link { cursor: pointer; } .cw-summary > div.is-link strong { color: var(--dd-accent); }
.pkg-grid-row.pkg-grid-head { display: none; }
@media (min-width: 901px) { .pkg-grid-row.pkg-grid-head { display: grid; } }
.booking-patient-bar .patient-chip-selected .ui-avatar { flex: none; width: 28px; height: 28px; }
@media (max-width: 600px) { .booking-patient-bar .patient-chip-selected > span:nth-child(3) { flex-basis: calc(100% - 120px); } }
/* Clinical OS v2 (L2): remembered patient is offered, never auto-confirmed. */
.cw-remembered { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; margin: 0 0 8px; padding: 8px 12px; border: 1px dashed var(--dd-accent, #2563eb); border-radius: var(--dd-r, 10px); background: var(--dd-accent-soft, #eef4ff); color: var(--dd-ink, #111); font: 500 14px var(--dd-font, inherit); text-align: left; cursor: pointer; }
.cw-remembered strong { font-weight: 600; }
.cw-remembered:focus-visible { outline: 2px solid var(--dd-focus, var(--dd-accent)); outline-offset: 2px; }
/* Clinical OS v2 (C-2): signed consent shows the patient's drawn signature. */
.consent-signed { display: grid; gap: 8px; min-width: 0; }
.consent-signature { margin: 0; padding: 10px; border: 1px solid var(--dd-line, #e5e7eb); border-radius: var(--dd-r, 10px); background: #fff; max-width: 100%; }
.consent-signature img { display: block; max-width: 100%; height: auto; max-height: 160px; object-fit: contain; }
.consent-signature figcaption { margin-top: 6px; font: 500 13px var(--dd-font, inherit); color: var(--dd-ink-2, #374151); }
/* C-3: consent page must never widen past the viewport — grid tracks shrink, long text wraps. */
.consent-centre { grid-template-columns: minmax(0, 1fr); }
.consent-centre > * { min-width: 0; }
.consent-legal p { overflow-wrap: anywhere; }
.consent-summary { flex-wrap: wrap; min-width: 0; }
.consent-choice { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
/* Clinical OS v2 (L22): server-searched patient picker in front of every patient select. */
.patient-picker { position: relative; display: grid; gap: 4px; min-width: 0; }
.patient-picker-input { width: 100%; min-width: 0; }
.patient-picker-native { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.patient-picker-results { position: absolute; z-index: 40; top: 100%; left: 0; right: 0; margin-top: 4px; display: grid; gap: 2px; padding: 4px; max-height: 280px; overflow: auto; background: var(--dd-surface, #fff); border: 1px solid var(--dd-line-strong, #d1d5db); border-radius: var(--dd-r, 10px); box-shadow: var(--dd-shadow-pop, 0 8px 24px rgba(0,0,0,.12)); }
html body.aesthetic-crm .patient-picker-results button { display: grid; gap: 2px; text-align: left; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--dd-ink, #111); font: 500 14px var(--dd-font, inherit); }
html body.aesthetic-crm .patient-picker-results button small { color: var(--dd-ink-3, #6b7280); font-weight: 400; font-size: 12px; }
html body.aesthetic-crm .patient-picker-results button:hover, html body.aesthetic-crm .patient-picker-results button.is-active { background: var(--dd-accent-soft, #eef4ff); }
.patient-picker-results p { margin: 6px 8px; }
/* Clinical OS v2 (P1/P4): a staff member can hold more than one role. */
.add-staff-extra-roles { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 0; padding: 8px 10px; border: 1px solid var(--dd-line, #e5e7eb); border-radius: var(--dd-r, 10px); min-width: 0; }
.add-staff-extra-roles legend { padding: 0 4px; font: 500 12px var(--dd-font, inherit); color: var(--dd-ink-2, #374151); }
.add-staff-extra-roles .check-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13px; }
/* Clinical OS v2 (L9): package covered services picked from the service catalogue. */
.plan-services { display: grid; gap: 8px; margin: 0; padding: 8px 10px; border: 1px solid var(--dd-line, #e5e7eb); border-radius: var(--dd-r, 10px); min-width: 0; }
.plan-services legend { padding: 0 4px; font: 500 12px var(--dd-font, inherit); }
.plan-services-list { display: flex; flex-wrap: wrap; gap: 6px 12px; max-height: 220px; overflow: auto; }
.plan-services .check-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13px; }
/* Clinical OS v2 (L20): resolve a possible duplicate patient inline. */
.dup-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.booking-duplicate-choices { display: grid; gap: 4px; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--dd-warning, #d97706); border-radius: var(--dd-r, 10px); background: var(--dd-warning-soft, #fff7ed); }
.booking-duplicate-choices[hidden] { display: none; }
