/* Flow Hospital: the Flow Technology bar and loading screen shared by
   every app page, plus base tokens for the hub page. Brand: cream background,
   royal blue main colour, marigold only as a highlighter. */
:root {
  --cream: #FBF6EC;
  --blue: #2233A8;
  --blue-deep: #18257E;
  --sun: #FFC93C;
  --ink: #141833;
  --muted: #5B5F7A;
  --line: #141833;
  --bar-h: 48px;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --font-logo: 'Shrikhand', 'Bricolage Grotesque', cursive;
}

html, body.flow-app {
  height: 100%;
  margin: 0;
}

body.flow-app {
  display: flex;
  flex-direction: column;
  background: var(--cream);
  overflow: hidden;
}

/* ---- The Flow bar ---------------------------------------------------- */
.flow-bar {
  flex: 0 0 var(--bar-h);
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
  background: var(--blue);
  color: var(--cream);
  font: 500 14px/1 var(--font-body);
  border-bottom: 2px solid var(--line);
  box-sizing: border-box;
  position: relative;
  z-index: 10;
}

.flow-bar a {
  color: inherit;
  text-decoration: none;
}

.flow-logo {
  font: 400 22px/1 var(--font-logo);
  letter-spacing: 0.2px;
  color: var(--cream);
  white-space: nowrap;
  padding-bottom: 3px;
}

.flow-place {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.flow-place .hospital {
  font: 700 15px/1 var(--font-display);
}

.flow-place .app .short { display: none; }

.flow-place .app {
  background: var(--sun);
  color: var(--ink);
  font: 700 12px/1 var(--font-body);
  padding: 4px 8px;
  border-radius: 999px;
}

.flow-place .who {
  color: rgba(251, 246, 236, 0.75);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-spacer { flex: 1; }

.flow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.flow-btn {
  display: inline-flex;
  align-items: center;
  white-space: pre;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--cream);
  background: transparent;
  color: var(--cream);
  font: 600 13px/1 var(--font-body);
  cursor: pointer;
}

.flow-btn:hover { background: rgba(251, 246, 236, 0.12); }

.flow-btn.solid {
  background: var(--cream);
  color: var(--blue);
}

.flow-btn.solid:hover { background: #fff; }

.flow-btn:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

/* Story mode button (the guide panel itself is drawn by the app). The app
   sets data-count ("3/10", "Done"), data-done and aria-expanded. */
.flow-btn.story { gap: 6px; position: relative; }
.flow-btn.story .material-icons { font-size: 17px; line-height: 1; }
.flow-btn.story::after {
  content: attr(data-label);
  font-variant-numeric: tabular-nums;
}
.flow-btn.story[data-count=""]::after { content: none; }
.flow-btn.story[data-done="1"]::after { content: attr(data-label) "\00a0\2713"; }
/* A story is running: "Step 3/8" replaces the word "Story". */
.flow-btn.story:not([data-count=""]) .word { display: none; }
.flow-btn.story[aria-expanded="true"] { background: var(--cream); color: var(--blue); }
.flow-btn.story .dot {
  position: absolute; top: -3px; right: -3px; width: 9px; height: 9px;
  border-radius: 999px; background: #2E8B57; border: 2px solid var(--blue);
  display: none;
}
.flow-btn.story[data-live="1"] .dot { display: block; }
.flow-btn.story .dot::after {
  content: ''; position: absolute; inset: -2px; border-radius: 999px;
  background: #2E8B57; animation: flow-pulse 1.8s ease-out infinite;
}
@keyframes flow-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-btn.story .dot::after { animation: none; }
}

/* "New here?" hint next to the Story button, once per app. On wide
   screens it sits inside the Flow bar (it covers nothing of the app); on
   phones there is no room, so it drops just below the bar for a moment. */
.flow-hint {
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  color: var(--cream);
  font: 600 13px/1 var(--font-body);
}
.flow-hint[hidden] { display: none; }
.flow-hint span { flex: 1 1 auto; }
.flow-hint button { flex: none; }
.flow-hint button {
  height: 26px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  font: 600 12px/1 var(--font-body); border: 2px solid var(--sun);
  background: var(--sun); color: var(--ink);
}
.flow-hint button.x {
  border-color: transparent; background: transparent; color: var(--cream);
  font-size: 17px; padding: 0 6px;
}
@media (max-width: 1100px) {
  .flow-hint {
    position: absolute;
    top: calc(var(--bar-h) + 6px);
    right: 12px;
    max-width: min(420px, calc(100vw - 24px));
    box-sizing: border-box;
    white-space: normal;
    background: #fff;
    color: var(--ink);
    border: 2px solid var(--line);
    border-radius: 14px;
    box-shadow: 4px 4px 0 var(--line);
    padding: 8px 6px 8px 12px;
    font: 600 14px/1.3 var(--font-body);
  }
  .flow-hint button { border-color: var(--blue); background: var(--blue); color: var(--cream); }
  .flow-hint button.x { color: var(--muted); }
}

/* Reset confirmation, shown under the bar. */
.flow-confirm {
  position: absolute;
  top: calc(var(--bar-h) + 6px);
  right: 12px;
  width: 280px;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--line);
  padding: 14px 16px;
  font: 400 14px/1.45 var(--font-body);
  display: none;
}

.flow-confirm.open { display: block; }
.flow-confirm p { margin: 0 0 12px; }
.flow-confirm .row { display: flex; gap: 8px; justify-content: flex-end; }
.flow-confirm button {
  height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  font: 600 13px/1 var(--font-body); border: 2px solid var(--line);
  background: #fff; color: var(--ink);
}
.flow-confirm button.danger { background: var(--blue); color: var(--cream); border-color: var(--blue); }

/* ---- Where Flutter renders ------------------------------------------- */
#flutter-host {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
}

/* ---- Loading screen --------------------------------------------------- */
#flow-splash {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  transition: opacity 0.35s ease;
}

#flow-splash.gone { opacity: 0; pointer-events: none; }

#flow-splash .mark { width: 72px; height: 72px; }

#flow-splash h1 {
  margin: 0;
  font: 800 26px/1.1 var(--font-display);
  color: var(--blue);
  text-align: center;
}

#flow-splash .sub {
  font-size: 15px;
  color: var(--muted);
}

#flow-splash .track {
  width: 200px;
  height: 6px;
  border-radius: 999px;
  border: 2px solid var(--line);
  overflow: hidden;
  background: #fff;
}

#flow-splash .track span {
  display: block;
  height: 100%;
  width: 35%;
  background: var(--blue);
  border-radius: 999px;
  animation: flow-load 1.2s ease-in-out infinite;
}

@keyframes flow-load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

#flow-splash .credit {
  position: absolute;
  bottom: 22px;
  font-size: 13px;
  color: var(--muted);
}

#flow-splash .credit strong { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  #flow-splash .track span { animation: none; width: 100%; }
}

/* ---- Small screens ---------------------------------------------------- */
@media (max-width: 760px) {
  .flow-place .who, .flow-btn .long { display: none; }
}

@media (max-width: 480px) {
  .flow-bar { gap: 6px; padding: 0 8px 0 10px; }
  .flow-logo { font-size: 19px; }
  .flow-place .hospital { display: none; }
  .flow-place .app { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .flow-actions { gap: 6px; }
  .flow-btn { padding: 0 9px; }
  .flow-btn.cta { display: none; }
  /* With a story running the button shows just "3/10" (and a tick), so
     the app's name keeps its room. */
  .flow-btn.story:not([data-count=""]) .material-icons { display: none; }
  .flow-btn.story::after { content: attr(data-count); }
  .flow-btn.story[data-done="1"]::after { content: "\2713\00a0" attr(data-count); }
  .flow-place .app .full { display: none; }
  .flow-place .app .short { display: inline; }
}
