/* Show Office shared screen styles. Colors and fonts come from theme.js. */
  :root { --r: 14px; --r-sm: 10px; --gut: 16px; }
  * { box-sizing: border-box; }
  html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.4; overflow-x: hidden; }
  select, input, textarea { max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  .num { font-variant-numeric: tabular-nums; }

  /* header */
  .top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--inset); }
  .top-in { max-width: 1320px; margin: 0 auto; padding: 10px var(--gut); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
  .logo { width: 40px; height: 40px; display: block; }
  .race h1 { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.15; margin: 0; font-optical-sizing: none; }
  .race .meta { color: var(--muted); font-size: 14px; }
  .top-actions { display: flex; gap: 8px; align-items: center; }
  .progress { color: var(--muted); font-size: 14px; white-space: nowrap; }
  .progress b { color: var(--text); }

  /* buttons */
  .btn { border: 1px solid var(--inset); background: var(--surface); border-radius: var(--r-sm); min-height: 48px; padding: 10px 14px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
  .btn:hover { background: var(--raised); }
  .btn:focus-visible, .timebox:focus-visible, .tab:focus-visible, .row-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
  .btn.primary { background: var(--accent); color: var(--accentInk); border-color: var(--accent); font-weight: 800; font-size: 18px; min-height: 60px; }
  .btn.primary:hover { background: var(--accentDeep); border-color: var(--accentDeep); }
  .btn.danger { color: #ff8a80; }
  .btn.slim { min-height: 40px; padding: 8px 12px; font-size: 14px; }
  .key { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--raised); border-radius: 5px; font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 600; }

  /* layout */
  .layout { max-width: 1320px; margin: 0 auto; padding: 16px var(--gut) 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  @media (min-width: 1000px) { .layout { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; } .col-left { position: sticky; top: 78px; } }
  .col-left, .col-right { display: grid; gap: 16px; min-width: 0; }
  .card { background: var(--surface); border: 1px solid var(--inset); border-radius: var(--r); padding: 18px; min-width: 0; }
  .card h2 { font-family: var(--display); font-size: 19px; margin: 0 0 12px; font-weight: 700; font-optical-sizing: none; }

  /* now running */
  .now-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
  .draw { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; font-size: 24px; font-weight: 800; color: var(--accent); }
  .now-label { color: var(--muted); font-size: 14px; }
  .rider { font-size: 26px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
  .horse { color: var(--muted); font-size: 17px; overflow-wrap: anywhere; }
  .timebox { display: block; width: 100%; margin: 16px 0 10px; font-size: 64px; font-weight: 800; text-align: center; letter-spacing: .02em; padding: 8px 10px; border-radius: var(--r); border: 2px solid var(--raised); background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
  .timebox::placeholder { color: var(--raised); }
  .timebox.bad { border-color: #ff6b6b; }
  .timebox.warn { border-color: #f5b041; }
  .barrels { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; margin-bottom: 10px; }
  .barrels .lbl { color: var(--muted); font-size: 15px; }
  .barrels .lbl b { color: var(--text); }
  .barrels .count { min-width: 74px; text-align: center; font-weight: 800; }
  .barrels .count.on { color: #f5b041; }
  .warnline { min-height: 0; color: #f5b041; font-size: 14px; margin: 0 0 10px; }
  .warnline:empty { display: none; }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
  .hint { color: var(--muted); font-size: 13px; margin-top: 12px; line-height: 1.7; }

  /* up next */
  .next-list { display: grid; gap: 2px; }
  .next-row { display: grid; grid-template-columns: 92px 40px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--inset); align-items: baseline; }
  .next-row:first-child { border-top: 0; }
  .next-row .tag { color: var(--muted); font-size: 13px; }
  .next-row .d { color: var(--muted); }
  .next-row .who b { display: block; overflow-wrap: anywhere; }
  .next-row .who span { color: var(--muted); font-size: 14px; }

  /* results */
  .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  @media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .stat { background: var(--bg); border: 1px solid var(--inset); border-radius: var(--r-sm); padding: 10px 12px; }
  .stat .k { color: var(--muted); font-size: 13px; }
  .stat .v { font-size: 22px; font-weight: 800; }
  .balance { margin: 12px 0 14px; font-size: 14px; color: var(--muted); }
  .balance .ok { color: var(--accent); font-weight: 700; }
  .balance .no { color: #ff6b6b; font-weight: 800; }
  .tabs { display: grid; gap: 8px; margin-bottom: 12px; }
  .tab { border: 1px solid var(--inset); background: var(--bg); border-radius: var(--r-sm); padding: 10px 6px; cursor: pointer; text-align: center; min-height: 58px; }
  .tab b { display: block; font-size: 17px; }
  .tab span { font-size: 13px; color: var(--muted); }
  .tab[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .drange { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
  .tbl { display: grid; }
  .tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) 76px 96px; gap: 8px; padding: 10px 4px; border-top: 1px solid var(--inset); align-items: center; }
  .tr.th { color: var(--muted); font-size: 13px; border-top: 0; padding-top: 0; }
  .tr .pl { font-weight: 800; }
  .tr .who b { display: block; overflow-wrap: anywhere; }
  .tr .who span { color: var(--muted); font-size: 14px; }
  .tr .t, .tr .amt { text-align: right; font-variant-numeric: tabular-nums; }
  .tr .amt { font-weight: 800; }
  .tr.unpaid .amt { color: var(--muted); font-weight: 400; }
  .tr.flash { animation: flash 2.4s ease-out; }
  @keyframes flash { from { background: rgba(63, 217, 224, .22); } to { background: transparent; } }
  @media (prefers-reduced-motion: reduce) { .tr.flash { animation: none; background: rgba(63, 217, 224, .12); } }
  .empty { color: var(--muted); padding: 16px 4px; }

  /* day sheet */
  .sheet-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
  .search { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--inset); background: var(--bg); }
  .row-btn { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; width: 100%; text-align: left; padding: 10px 6px; background: none; border: 0; border-top: 1px solid var(--inset); cursor: pointer; align-items: center; border-radius: 0; }
  .row-btn:hover { background: var(--bg); }
  .row-btn.cur { background: rgba(63, 217, 224, .08); box-shadow: inset 3px 0 0 var(--accent); }
  .row-btn .dn { color: var(--muted); font-weight: 700; }
  .row-btn .who b { display: block; overflow-wrap: anywhere; }
  .row-btn .who span { color: var(--muted); font-size: 14px; }
  .row-btn .res { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
  .row-btn .res .t { font-weight: 700; display: block; }
  .row-btn .res .s { color: var(--muted); }
  .row-btn .res .nt { color: #ff8a80; font-weight: 700; }

  /* dialogs (FU-0111: in-page, never alert/confirm/prompt) */
  dialog { border: 1px solid var(--inset); border-radius: var(--r); background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
  dialog::backdrop { background: rgba(0, 0, 0, .65); }
  .dlg { padding: 20px; display: grid; gap: 12px; }
  .dlg h3 { font-family: var(--display); margin: 0; font-size: 21px; font-optical-sizing: none; }
  .dlg p { margin: 0; color: var(--muted); }
  .field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
  .field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--inset); background: var(--bg); }
  .field textarea { min-height: 150px; font-variant-numeric: tabular-nums; }
  .field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
  .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dlg-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
  .err { color: #ff8a80; font-size: 14px; }
  .err:empty { display: none; }
  .log-row { padding: 8px 0; border-top: 1px solid var(--inset); font-size: 14px; }
  .log-row .when { color: var(--muted); }
  .log-list { max-height: 60vh; overflow-y: auto; }

  /* toast */
  .toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(140%); width: min(560px, calc(100vw - 32px)); background: var(--text); color: var(--bg); border-radius: var(--r); padding: 12px 12px 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; transition: transform .25s ease; z-index: 20; visibility: hidden; }
  .toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
  .toast button { background: var(--bg); color: var(--text); border: 0; border-radius: var(--r-sm); min-height: 44px; padding: 8px 16px; font-weight: 700; cursor: pointer; }
  .foot { max-width: 1320px; margin: 0 auto; padding: 0 var(--gut) 90px; color: var(--muted); font-size: 13px; }

  @media (max-width: 640px) {
    .top-in { grid-template-columns: auto minmax(0, 1fr); }
    .top-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
    .race h1 { font-size: 19px; }
    .timebox { font-size: 52px; }
    .tr { grid-template-columns: 34px minmax(0, 1fr) 64px 84px; gap: 6px; font-size: 15px; }
    .next-row { grid-template-columns: 78px 34px minmax(0, 1fr); }
  }

  /* shared nav between the demo screens (wraps, never scrolls sideways) */
  .nav { max-width: 1320px; margin: 0 auto; padding: 0 var(--gut) 10px; display: flex; flex-wrap: wrap; gap: 6px; }
  .nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--inset); }
  .nav a[aria-current="page"] { color: var(--accentInk); background: var(--accent); border-color: var(--accent); }
  .pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--inset); color: var(--muted); white-space: nowrap; }
  .pill.draft { color: #f5b041; border-color: rgba(245, 176, 65, .45); }
  .pill.pub { color: var(--accent); border-color: rgba(63, 217, 224, .45); }
  .pill.off { color: var(--accentInk); background: var(--accent); border-color: var(--accent); }
  .classes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .classes .btn { min-height: 42px; }
  .classes .btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 15px; margin-bottom: 10px; cursor: pointer; }
  .check input { width: 20px; height: 20px; accent-color: var(--accent); }
  .diff { display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; font-size: 14px; }
  .diff div { padding: 6px 0; border-top: 1px solid var(--inset); }
  .note { font-size: 13px; color: var(--muted); }
  a.btn { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
  a.btn.primary { color: var(--accentInk); }
  /* design rule 25: on phones the header scrolls away instead of covering the run card */
  @media (max-width: 640px) { .top { position: static; } .hint { display: none; } }
