/* Codex fix — owner review: app-only layout; shared palette and controls remain in styles.css. */
/* UI-5: the palette is brand/tokens.css (imported here and by ../styles.css; the browser loads it once). */
@import url("brand/tokens.css");
body[data-page^="app-"] { overflow-wrap: anywhere; }
.app-frame { width: min(100%, 44rem); margin: 0 auto; padding: 1rem; }
.app-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.app-nav { display: flex; flex-wrap: wrap; gap: .75rem; }
.app-nav a, .app-frame button { min-height: 44px; display: inline-flex; align-items: center; }
.app-frame input { width: 100%; min-height: 44px; }
.app-frame .card { min-width: 0; }
.app-frame ul { padding-left: 1.25rem; }
.app-frame :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 360px) { .app-frame { padding: .75rem; } }
/* Codex fix — owner review: P5-26 nonmodal Help overlay leaves the meeting lifecycle untouched. */
[data-mm-slot="help"] a { display: block; min-height: 44px; padding: .5rem 0; }
body[data-page="app-room"] [data-mm-slot="help"] { position: fixed; inset: 1rem; z-index: 10; max-width: 42rem; margin: auto; overflow-y: auto; background: var(--panel); color: var(--ink); padding: 1rem; border: 2px solid var(--accent); }

.app-nav :is(a,button) { min-height: 44px; display: inline-flex; align-items: center; padding: 0; background: transparent; border: 0; border-radius: 0; color: var(--accent); font-weight: 600; font-size: inherit; text-decoration: underline; }
.app-header img { width: 150px; max-width: 100%; }

.app-frame #rooms ul {list-style:none;padding:0;display:grid;gap:12px;}
.app-frame #rooms li {margin:0;padding:20px;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);}
.app-frame #rooms li a {display:flex;align-items:center;min-height:44px;font-weight:700;}

/* UI-6 (READY-TICKETS §6.58): who is in which room. The rooms page widens into two columns from 900 px:
   the "In rooms now" panel on the left, the tiles on the right. Under 900 px the panel is a sheet that
   the header button opens. Every colour is a token. */
body[data-page="staff-home"] .app-frame { width: min(100%, 72rem); }
@media (min-width: 900px) {
  body[data-page="staff-home"] .app-frame { display: grid; grid-template-columns: 300px minmax(0, 1fr); column-gap: 24px; grid-auto-flow: dense; align-items: start; }
  body[data-page="staff-home"] .app-frame > * { grid-column: 1 / -1; }
  body[data-page="staff-home"] .app-frame > #presence-panel { grid-column: 1; }
  body[data-page="staff-home"] .app-frame > #rooms { grid-column: 2; }
  .app-frame .presence-open, .app-frame .presence-close { display: none; } /* beats .app-frame button */
}
.presence-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
@media (max-width: 899px) {
  .presence-panel { display: none; }
  .presence-panel.open { display: block; position: fixed; inset: 0; z-index: 20; overflow: auto; border: 0; border-radius: 0; box-shadow: none; }
}
.presence-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.presence-head h2 { margin: 0; }
.presence-search { display: block; margin: 12px 0; font-weight: 650; }
.presence-search input { width: 100%; margin-top: 6px; }
#presence-list, .presence-people, .waiting-list, .room-people { list-style: none; padding: 0; margin: 0; }
#presence-list > li { padding: 10px 0; border-top: 1px solid var(--line); }
#presence-list h3, .presence-waiting h3 { margin: 0 0 4px; font-size: 1rem; }
.presence-waiting { padding: 10px 0; border-top: 1px solid var(--line); }
.presence-people li, .waiting-list li, .room-people li { padding: 4px 0; color: var(--muted); overflow-wrap: anywhere; }
.presence-people .name, .waiting-list .name, .room-people .name { color: var(--ink); font-weight: 650; }
/* tiles. The lists inside a tile (people, waiting patients) are plain lines, not the grid of cards that
   .app-frame #rooms ul and li draw. */
.app-frame #rooms li { min-width: 0; }
.app-frame #rooms .room-people, .app-frame #rooms .waiting-list { display: block; gap: 0; }
.app-frame #rooms .room-people li, .app-frame #rooms .waiting-list li { margin: 0; padding: 4px 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.room-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-row a { flex: 1 1 auto; min-width: 0; }
.room-row h2 { margin: 0; }
.room-count { flex: none; min-width: 44px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 750; justify-content: center; margin: 0; }
.room-count:hover { background: var(--accent-hover); }
.room-meta { margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); display: none; }
.app-frame #rooms li:hover > .room-meta, .app-frame #rooms li:focus-within > .room-meta { display: block; }
.app-frame #rooms .room-people { display: none; margin-top: 6px; }
.app-frame #rooms li:hover > .room-people, .app-frame #rooms li:focus-within > .room-people, .app-frame #rooms li.open > .room-people { display: block; }
@media (hover: none) { .room-meta { display: block; } }
.app-frame #rooms li.linked-room { outline: 2px solid var(--accent); outline-offset: 3px; }
.waiting-band { margin-top: 12px; }
.waiting-band .room-count { display: inline-flex; align-items: center; }
.waiting-note:empty { display: none; }
/* UI-7: the "Move to" control of a named waiting patient, on its own line under the name and timers. */
.move-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.move-control label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 650; color: var(--ink); }
.move-control select { max-width: 100%; min-width: 0; }
.move-status { margin: 6px 0 0; }
.move-status:empty { display: none; }

/* UI-9: the private label (accent, next to the room's name) and note (at the bottom) on every tile:
   quiet fields that look like text until pointed at or focused. */
.app-frame #rooms .room-label { flex: 0 1 14rem; width: auto; min-width: 6rem; margin: 0; padding: 6px 8px; border: 1px solid transparent; background: transparent; color: var(--accent); font-weight: 650; }
.app-frame #rooms .room-note { width: 100%; margin: 0; padding: 6px 8px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.app-frame #rooms .room-label:hover, .app-frame #rooms .room-note:hover { border-color: var(--line); }
.app-frame #rooms .room-label:focus, .app-frame #rooms .room-note:focus { border-color: var(--line); background: var(--panel); color: var(--ink); }
.room-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.room-note-status { flex: none; font-size: 0.85rem; color: var(--muted); }
.room-note-status:empty { display: none; }
@media (max-width: 640px) { .room-row { flex-wrap: wrap; } .app-frame #rooms .room-label { flex: 1 1 100%; order: 3; } }

/* UI-8: the practice's layout. Two columns of tiles from 900 px, a wide tile spanning both; one column
   under 900 px. While an administrator arranges, the tiles are draggable and carry their buttons. */
@media (min-width: 900px) {
  .app-frame #rooms > section > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-frame #rooms > section > ul > li.wide { grid-column: 1 / -1; }
}
.layout-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 12px; }
.layout-bar button { margin: 0; }
.layout-bar #layout-cancel, .layout-bar #layout-waiting { background: var(--panel); color: var(--accent); border: 1px solid var(--line); }
.layout-bar #layout-status { margin: 0; flex: 1 1 100%; }
.layout-bar #layout-status:empty { display: none; }
.tile-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tile-tools button { margin: 0; padding: 6px 10px; font-size: 0.85rem; background: var(--panel); color: var(--accent); border: 1px solid var(--line); }
.tile-tools button[aria-pressed="true"] { background: var(--accent-soft); }
.app-frame #rooms.arranging > section > ul > li { cursor: move; border-style: dashed; }
.app-frame #rooms.arranging > section > ul:empty { min-height: 60px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* UI-10: a supervisor's requests for managed rooms. */
.room-requests { margin-top: 24px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.room-requests h2, .room-requests h3 { margin: 0 0 8px; }
.request-form label { display: block; margin: 10px 0; font-weight: 650; }
.request-form input { margin-top: 6px; }
.request-form button { margin: 8px 8px 0 0; }
.request-form button[type="button"] { background: var(--panel); color: var(--accent); border: 1px solid var(--line); }
.request-list { list-style: none; padding: 0; margin: 0; }
.request-list li { padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.request-list .name { font-weight: 650; }
.request-delete { margin-top: 8px; }
.app-frame #rooms .request-delete button { margin: 0; padding: 6px 10px; font-size: 0.85rem; background: var(--panel); color: var(--accent); border: 1px solid var(--line); }
.app-frame #rooms .request-delete .request-form { margin-top: 8px; }


/* UI-14: approved wordmark starts at 32.5% of the exact transparent logo width. */
.practice-brand { display: inline-flex; flex-direction: column; align-items: stretch; width: var(--practice-logo-width,174px); max-width: 100%; flex-shrink: 0; }
.practice-brand img { display: block; width: 100%; height: auto; }
.practice-subtitle { display: block; margin: var(--practice-subtitle-gap) 0 0; padding-left: var(--practice-wordmark-start); color: var(--muted); font: 500 var(--practice-subtitle-size)/1.25 var(--font-sans); overflow-wrap: anywhere; text-align: left; }
.login-story > .practice-brand { --practice-logo-width: 280px; }
.brand-header .practice-brand { vertical-align: middle; }
.wm:has(> .practice-brand) { display: block; margin: 0; }
.app-header a:has(> .practice-brand) { min-width: 0; max-width: 65%; }

/* UI-13: room/help/device and authentication pages use the same rounded system. */
.app-header { padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.app-nav { gap: .5rem; margin: .75rem 0; }
.app-nav :is(a,button) { padding: .5rem .75rem; border-radius: var(--radius-sm); text-decoration: none; background: var(--accent-soft); }
.app-frame :is(h1,h2,h3) { letter-spacing: -.02em; }
.app-frame :is(input,select,textarea) { border-radius: var(--radius-sm); }

/* Approved October14 staff-home composition, using existing shared tokens. */
.staff-home { width: 100%; max-width: none; padding: 0; }
.wrap:has(.staff-home) { max-width: 1440px; }
.staff-home button { cursor: pointer; font: inherit; border-radius: var(--radius-sm); border: 1px solid var(--line); padding: .5rem .75rem; background: var(--panel); color: var(--ink); }
.staff-home input, .room-note-dialog input { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); padding: .5rem; border-radius: var(--radius-sm); }
.staff-home #rooms .room-row > a { font-weight: 750; text-decoration: none; font-size: 1.15rem; color: var(--ink); }
.staff-home #rooms .room-row { align-items: center; }
.staff-home #rooms .room-meta { display: block; }
.staff-home .room-foot { display: flex; flex-wrap: wrap; gap: .5rem; }
.staff-home .edit-note { font-size: .8rem; }
.staff-home #rooms.arranging [data-tile] { touch-action: none; animation: room-jiggle .24s ease-in-out infinite alternate; }
@keyframes room-jiggle { from { rotate: -.35deg; } to { rotate: .35deg; } }
.staff-home #rooms .clinic-occupants { display: block; position: static; box-shadow: none; }
.staff-home #waiting-band { margin: 0 0 1rem; }
.staff-home #rooms #waiting-band > ul { display: block; }
.room-note-dialog { max-width: min(90vw,28rem); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); color: var(--ink); padding: 1.5rem; }
.room-note-dialog::backdrop { background: var(--ink); opacity: .4; }
.room-note-dialog label { display: block; margin-block: .75rem; }
.room-note-dialog input { display: block; width: 100%; min-height: 44px; }
.room-note-dialog button { min-height: 44px; padding: .5rem 1rem; margin-right: .5rem; font: inherit; }
@media (min-width: 900px) { .staff-home #rooms > section > ul { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (prefers-reduced-motion: reduce) { .staff-home #rooms.arranging [data-tile] { animation: none; } }
body[data-page="staff-home"] .page-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1rem; }
body[data-page="staff-home"] .page-head .lede { display:none; }
body[data-page="staff-home"] .page-head .who { margin:0; }
.staff-home #rooms [data-tile] { position:relative; }
.staff-home #rooms .room-count { border:0; border-radius:50%; background:var(--accent); color:var(--accent-ink); justify-content:center; font-weight:750; min-width:44px; height:44px; }
.staff-home #rooms [data-tile] > .room-row > .room-count { position:absolute; top:-12px; right:12px; }
.staff-home #rooms > section[data-band="clinic"] { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.staff-home #rooms > section[data-band="clinic"] > h2 { grid-column:1/-1; }
.staff-home #rooms > section[data-band="clinic"] > ul { display:contents; }
.staff-home #rooms #waiting-band { padding:20px; margin:0; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); min-width:0; }
.staff-home #rooms #waiting-band .room-row { flex-wrap:wrap; }
.staff-home #rooms .waiting-note:empty, .staff-home #rooms .move-status:empty { display:none; }
@media(max-width:899px) { .staff-home #rooms > section[data-band="clinic"] { grid-template-columns:minmax(0,1fr); } }

/* Team creation stays in document flow at phone and desktop widths. */
.staff-home .team-create-form:not([hidden]) { display:grid; gap:12px; margin-block:12px; min-width:0; }
.staff-home .team-create-form label { display:grid; gap:8px; margin:0; min-width:0; }
.staff-home .team-create-form input { display:block; width:100%; min-width:0; box-sizing:border-box; min-height:44px; }
.staff-home .team-create-actions { display:flex; flex-wrap:wrap; gap:8px; }
.staff-home .team-create-actions button { margin:0; min-height:44px; }
.staff-home .team-create-form [role="status"] { margin:0; overflow-wrap:anywhere; }
