/* Candela Digital: the three working demos on the internal software page (a roster, a booking form, a dashboard).
   Every selector starts with .app, and each demo sizes itself to its own width (320px to about 560px), not the screen.
   Graphite is the ink for anything chosen. Ultraviolet is kept for the one primary button, the selected tab and the
   focus ring. Hairlines, no shadows. Colours come from style.css, with fallbacks so this file also stands alone. */
.app {
  --app-ink: var(--graphite, #1E1F26);
  --app-ink-2: var(--graphite-2, #2A2B33);
  --app-stone: var(--stone, #EDEBE6);
  --app-paper: var(--stone-light, #F6F5F2);
  --app-line: var(--line, #D9D6CF);
  --app-mute: var(--slate, #62636D);
  --app-accent: var(--mint-ink, #0A7765);
  --app-accent-dark: #075C4E;
  --app-ease: var(--ease-out, cubic-bezier(.23, 1, .32, 1));
  container: app / inline-size;
  position: relative; width: 100%; max-width: 560px; min-width: 0;
  border-radius: 10px; overflow: hidden;
  background: #fff; color: var(--app-ink);
  font: 400 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
}
.app, .app *, .app *::before, .app *::after { box-sizing: border-box; }

/* The window: a graphite title bar with three dots, then the body */
.app-bar { display: flex; align-items: center; min-height: 36px; padding: 8px 14px; background: var(--app-ink); color: #D8D7DE; }
.app-bar::before { content: ""; flex: none; width: 7px; height: 7px; margin-right: 36px; border-radius: 50%; background: #5B5C66; box-shadow: 12px 0 0 #5B5C66, 24px 0 0 #5B5C66; }
.app-bar-title { min-width: 0; font: 700 12px/1.3 Sora, "Sora Fallback", sans-serif; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-body { padding: 16px; border: 1px solid var(--app-line); border-top: 0; border-radius: 0 0 10px 10px; background: #fff; }

/* Shared pieces */
.app-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.app-sr th, .app-sr td { letter-spacing: 0; text-transform: none; }
.app :focus-visible { outline: 3px solid var(--app-accent); outline-offset: 2px; }
.app-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.app-org { margin: 0; font: 700 16px/1.25 Sora, "Sora Fallback", sans-serif; letter-spacing: -0.01em; }
.app-note { margin: 2px 0 0; font-size: 13px; color: var(--app-mute); }
.app-tag { flex: none; align-self: flex-start; margin-top: 1px; padding: 3px 9px; border: 1px solid var(--app-line); border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.4; color: var(--app-mute); white-space: nowrap; }

/* Buttons. Everything pressable gives a little under the finger. */
.app-btn, .app-link, .app-shift, .app-tab { -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.app-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 0 22px;
  border: 1.5px solid transparent; border-radius: 999px; font: 700 14px/1 Sora, "Sora Fallback", sans-serif; white-space: nowrap; cursor: pointer;
  transition: transform 160ms var(--app-ease), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.app-btn:active { transform: scale(.97); }
.app-btn-primary { width: 100%; background: var(--app-accent); border-color: var(--app-accent); color: #fff; }
.app-btn-primary:disabled { background: var(--app-stone); border-color: var(--app-stone); color: var(--app-mute); opacity: 1; cursor: default; transform: none; }
.app-btn-ghost { background: transparent; border-color: var(--app-ink); color: var(--app-ink); }
.app-link { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 44px; min-height: 44px; margin: 0; padding: 0 2px; border: 0; background: none; color: var(--app-ink); font: 700 13px/1 Sora, "Sora Fallback", sans-serif; cursor: pointer; transition: transform 160ms var(--app-ease); }
.app-link span { padding-bottom: 2px; border-bottom: 2px solid var(--app-line); transition: border-color 160ms ease; }
.app-link:active { transform: scale(.97); }

/* ---------- Roster ---------- */
.app-grid { width: calc(100% + 8px); margin: 10px -4px 0; border-collapse: separate; border-spacing: 4px; table-layout: fixed; font-size: inherit; }
.app-grid th, .app-grid td { padding: 0; border: 0; font: inherit; letter-spacing: 0; text-transform: none; color: inherit; vertical-align: middle; }
.app-grid thead th { height: 42px; padding-bottom: 2px; text-align: center; vertical-align: bottom; }
.app-grid thead th:first-child { width: 64px; }
.app-grid tbody th { text-align: left; }
.app-day { display: block; font: 700 12px/1.2 Sora, "Sora Fallback", sans-serif; color: var(--app-mute); }
.app-cover { display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.35; font-variant-numeric: tabular-nums; color: var(--app-mute); transition: background-color 160ms ease, color 160ms ease; }
.app-grid .is-short .app-day { color: var(--app-ink); }
.app-grid .is-short .app-cover { background: var(--app-ink); color: #fff; }
.app-name { display: block; font: 700 13px/1.25 Sora, "Sora Fallback", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-hours { display: block; font-size: 12px; line-height: 1.3; color: var(--app-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-shift {
  position: relative; display: grid; place-items: center; width: 100%; height: 44px; margin: 0; padding: 0;
  border: 1px solid var(--app-line); border-radius: 6px; background: #fff; color: var(--app-mute);
  font: 700 13px/1 Sora, "Sora Fallback", sans-serif; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: transform 160ms var(--app-ease), background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.app-shift.is-needed { border: 1.5px dashed #8E8F98; color: var(--app-ink); }
.app-shift[aria-pressed="true"] { border: 1px solid var(--app-ink); background: var(--app-ink); color: #fff; }
.app-shift:active { transform: scale(.97); }
.app-shift:focus-visible { z-index: 1; }
.app-status { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--app-line); }
.app-status-text { margin: 0; min-height: 2.9em; font-weight: 600; }
.app-status-icon { position: relative; width: 18px; height: 18px; margin-top: 1px; border: 2px solid var(--app-ink); border-radius: 50%; transition: background-color 160ms ease; }
.app-status-icon::after { content: ""; position: absolute; left: 4px; top: 1px; width: 6px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; opacity: 0; transform: rotate(45deg) scale(.7); transition: opacity 160ms ease, transform 160ms var(--app-ease); }
.app-roster.is-covered .app-status-icon { background: var(--app-ink); }
.app-roster.is-covered .app-status-icon::after { opacity: 1; transform: rotate(45deg); }

/* ---------- Booking ---------- */
.app-stack { display: grid; }
.app-stack > * { grid-area: 1 / 1; min-width: 0; }
.app-form { margin: 0; transition: opacity 140ms ease; }
.app-field { min-width: 0; margin: 14px 0 0; padding: 0; border: 0; }
.app-field legend { display: block; width: 100%; margin: 0 0 6px; padding: 0; font: 700 12px/1.3 Sora, "Sora Fallback", sans-serif; letter-spacing: .02em; color: var(--app-mute); }
.app-opts { display: grid; gap: 6px; }
.app-opts-day { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.app-opts-time { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app-opt { position: relative; display: block; margin: 0; font: inherit; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.app .app-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 8px; opacity: 0; appearance: none; -webkit-appearance: none; cursor: pointer; touch-action: manipulation; }
.app .app-opt input:disabled { cursor: not-allowed; }
.app-opt-face {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 2px 10px; min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--app-line); border-radius: 8px; background: #fff; color: var(--app-ink); pointer-events: none;
  transition: transform 160ms var(--app-ease), background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.app-opt-main { font: 700 13px/1.2 Sora, "Sora Fallback", sans-serif; font-variant-numeric: tabular-nums; }
.app-opt-sub { font-size: 12.5px; line-height: 1.2; color: var(--app-mute); white-space: nowrap; transition: color 140ms ease; }
.app-opts-service .app-opt-face { justify-content: space-between; padding: 6px 12px; }
.app-opts-day .app-opt-face { flex-direction: column; min-height: 52px; padding: 6px 2px; }
.app-opts-day .app-opt-main { font-size: 15px; }
.app-opts-time .app-opt-face { padding: 6px 2px; }
.app-opt input:checked + .app-opt-face { border-color: var(--app-ink); background: var(--app-ink); color: #fff; }
.app-opt input:checked + .app-opt-face .app-opt-sub { color: #D8D7DE; }
.app-opt input:disabled + .app-opt-face { border-color: var(--app-paper); background: var(--app-paper); color: var(--app-mute); text-decoration: line-through; }
.app-opt input:disabled + .app-opt-face::after { content: " taken"; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-opt input:focus-visible + .app-opt-face { outline: 3px solid var(--app-accent); outline-offset: 2px; z-index: 1; }
.app-opt input:not(:disabled):active + .app-opt-face { transform: scale(.97); }
.app-foot { display: grid; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--app-line); }
.app-summary { margin: 0; min-height: 2.9em; font-weight: 600; }
.app-done { display: grid; justify-items: center; align-content: center; gap: 6px; padding: 8px 0; text-align: center; transition: opacity 200ms var(--app-ease), transform 200ms var(--app-ease); }
.app-done[hidden] { display: none; }
.app-done-icon { position: relative; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 50%; background: var(--app-ink); }
.app-done-icon::after { content: ""; position: absolute; left: 14px; top: 8px; width: 11px; height: 19px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.app-done-msg { margin: 0; max-width: 26ch; font: 700 17px/1.3 Sora, "Sora Fallback", sans-serif; letter-spacing: -0.01em; text-wrap: balance; }
.app .app-done-msg:focus-visible { outline: none; }
.app-done .app-btn { margin-top: 14px; }
.app-booking.is-done .app-form { visibility: hidden; opacity: 0; transition: opacity 140ms ease, visibility 0s linear 140ms; }
@starting-style { .app-done { opacity: 0; transform: translateY(8px); } }

/* ---------- Dashboard ---------- */
.app-tabs { display: flex; gap: 18px; margin-top: 6px; border-bottom: 1px solid var(--app-line); }
.app-tab { position: relative; min-width: 44px; min-height: 44px; margin: 0; padding: 0 2px; border: 0; background: none; color: var(--app-mute); font: 700 13px/1 Sora, "Sora Fallback", sans-serif; cursor: pointer; transition: transform 160ms var(--app-ease), color 160ms ease; }
.app-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--app-accent); opacity: 0; transform: scaleX(.4); transition: opacity 160ms ease, transform 180ms var(--app-ease); }
.app-tab[aria-selected="true"] { color: var(--app-ink); }
.app-tab[aria-selected="true"]::after { opacity: 1; transform: none; }
.app-tab:active { transform: scale(.97); }
.app-tab:focus-visible { z-index: 1; }
.app-panel { border-radius: 4px; }
.app-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 14px 0; border-bottom: 1px solid var(--app-line); }
.app-tile { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: 0 0 0 12px; border-left: 1px solid var(--app-line); }
.app-tile:first-child { padding-left: 0; border-left: 0; }
.app-tile dt { margin: 0; font-size: 12.5px; line-height: 1.3; color: var(--app-mute); }
.app-tile dd { margin: 4px 0 0; font: 700 26px/1.1 Sora, "Sora Fallback", sans-serif; letter-spacing: -0.02em; }
.app-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; }
.app-chart-title { margin: 0; font: 700 13px/1.3 Sora, "Sora Fallback", sans-serif; white-space: nowrap; }
.app-period { display: inline-block; font-size: 12.5px; color: var(--app-mute); white-space: nowrap; }
.app-period::first-letter { text-transform: uppercase; }
/* One series, one colour. Each bar is a full-width strip slid into view from behind the axis, so its rounded end
   keeps its shape and only transform moves; the value rides the end of the bar. */
.app-chart { --app-label: 112px; margin-top: 8px; }
.app-chart-row { display: grid; grid-template-columns: var(--app-label) minmax(0, 1fr); align-items: center; height: 28px; }
.app-chart-label { padding-right: 10px; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.app-chart-plot { position: relative; display: block; height: 100%; margin-right: 34px; border-left: 1px solid var(--app-line); }
.app-chart-clip { position: absolute; inset: 0; display: flex; align-items: center; overflow: hidden; }
.app-chart-fill { display: block; width: 100%; height: 12px; border-radius: 0 4px 4px 0; background: var(--app-ink); transform: translateX(calc(var(--v, 0) * 100% - 100%)); transition: transform 220ms var(--app-ease); }
.app-chart-tip { position: absolute; inset: 0; display: flex; align-items: center; pointer-events: none; transform: translateX(calc(var(--v, 0) * 100%)); transition: transform 220ms var(--app-ease); }
.app-chart-val { padding-left: 6px; font-size: 12.5px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }

/* Room to breathe once a demo is wider than a phone */
@container app (min-width: 440px) {
  .app-body { padding: 20px; }
  .app-grid thead th:first-child { width: 92px; }
  .app-shift { height: 46px; font-size: 14px; }
  .app-name { font-size: 14px; }
  .app-opts-service { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-opts-service .app-opt-face { flex-direction: column; align-items: flex-start; justify-content: center; min-height: 56px; }
  .app-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .app-btn-primary { width: auto; }
  .app-tabs { gap: 24px; }
  .app-tile dd { font-size: 30px; }
  .app-chart { --app-label: 132px; }
  .app-chart-row { height: 32px; }
  .app-chart-fill { height: 14px; }
}

/* Narrower than the smallest phone: keep a third line for the longest status so nothing jumps */
@container app (max-width: 319px) {
  .app-status-text, .app-summary { min-height: 4.35em; }
}

/* Hover is a nicety for a mouse, never the only signal */
@media (hover: hover) and (pointer: fine) {
  .app-shift:hover { border-color: var(--app-ink); color: var(--app-ink); }
  .app-shift[aria-pressed="true"]:hover { background: var(--app-ink-2); color: #fff; }
  .app-link:hover span { border-color: currentColor; }
  .app-opt input:not(:disabled):not(:checked):hover + .app-opt-face { border-color: var(--app-ink); }
  .app-tab:hover { color: var(--app-ink); }
  .app-btn-primary:not(:disabled):hover { background: var(--app-accent-dark); border-color: var(--app-accent-dark); }
  .app-btn-ghost:hover { background: var(--app-ink); color: #fff; }
}

/* Reduced motion: every state lands at once */
@media (prefers-reduced-motion: reduce) {
  .app *, .app *::before, .app *::after { transition: none !important; animation: none !important; }
}

/* High-contrast modes repaint backgrounds, so the filled states say so explicitly */
@media (forced-colors: active) {
  .app-shift[aria-pressed="true"], .app-opt input:checked + .app-opt-face { forced-color-adjust: none; background: Highlight; border-color: Highlight; color: HighlightText; }
  .app-chart-fill { forced-color-adjust: none; background: CanvasText; }
  .app-tab::after { forced-color-adjust: none; background: Highlight; }
}
