/*~ Studio front end styles: dialogs (moved out of index.html, batch 96 - same rules, same order) */

  /* ---- dialogs and toast (BMS AR's) */
  dialog { border: none; border-radius: 8px; padding: 0; width: 440px; max-width: 94vw; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
  dialog::backdrop { background: rgba(20, 40, 70, .45); }
  dialog > h2, dialog > form > h2, .tray > h2 { cursor: move; user-select: none; }   /* drag a popup by its title bar */
  dialog form > h2 { margin: 0; padding: 12px 18px; background: var(--blue); color: var(--mint); font-size: 15px; font-weight: 600; }
  dialog form > .body { padding: 16px 18px; }
  /* BMS AR's ask boxes: in place of the browser's own prompt / confirm / alert */
  #ask { width: min(460px, calc(100vw - 32px)); }
  #ask .msg { max-height: 60vh; overflow: auto; }
  #ask > h2 { margin: 0; padding: 12px 48px 12px 18px; background: var(--blue); color: var(--mint); font-size: 15px; font-weight: 600; position: relative; }
  #ask > .body { padding: 16px 18px; }
  #ask .msg { white-space: pre-line; line-height: 1.45; }
  #ask input { width: 100%; box-sizing: border-box; margin-top: 12px; }
  #ask .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
  #ask button.danger.primary { background: var(--alarm); border-color: var(--alarm); color: #fff; }
  #ask .dlgx { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; padding: 0; border-radius: 50%;
    background: transparent; border: 0; color: inherit; font-size: 16px; line-height: 32px; cursor: pointer; opacity: .8; }
  #ask .dlgx:hover { opacity: 1; background: rgba(255,255,255,.18); }
  .toast { position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px)); background: var(--blue);
    color: var(--on-primary); padding: 10px 16px; border-radius: 5px; box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 47; font-size: 14px; }
  /* ---- Home: Recent jobs in a panel that slides in from the right edge (Simon, 10 Oct 2026) - a slim bar down the
     right of the window, from under the menu to above the footer and Feedback; the panel is a card like any other */
  .sjbar { position: fixed; right: 0; top: var(--sjtop, 112px); bottom: 92px; width: 28px; z-index: 55; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; padding: 10px 0; border: 0; border-radius: 6px 0 0 6px; background: var(--blue);
    color: var(--mint); cursor: pointer; box-shadow: -2px 0 10px rgba(0, 0, 0, .14); font: 600 13px var(--head); }
  .sjbar:hover, .sjbar[aria-expanded=true] { background: var(--blue-dark); }
  .sjbar:focus-visible { outline: 2px solid var(--mint); outline-offset: -4px; }
  .sjbar .lbl { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; white-space: nowrap; }
  .sjbar .n { font-size: 11px; line-height: 18px; min-width: 18px; padding: 0 4px; border-radius: 9px; text-align: center;
    background: color-mix(in srgb, var(--mint) 28%, transparent); color: var(--on-primary); }
  .sjbar .n:empty { display: none; }
  .sjbar .dot { width: 9px; height: 9px; border-radius: 50%; display: none; flex: none; }
  .sjbar .dot.run { display: block; background: var(--mint); animation: sjpulse 1.6s ease-in-out infinite; }
  .sjbar .dot.review { display: block; background: var(--warn); }
  @keyframes sjpulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 35%, transparent); } }
  .sjpanel { position: fixed; top: var(--sjtop, 112px); bottom: 92px; right: 28px; width: min(1200px, 92vw, calc(100vw - 60px)); z-index: 55; margin: 0;
    display: flex; flex-direction: column; border-radius: 6px 0 0 6px; box-shadow: -8px 0 30px rgba(0, 0, 0, .2);
    transform: translateX(calc(100% + 40px)); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  .sjpanel.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .sjpanel > h2 { flex: none; }
  .sjpanel > h2 .sjx { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; font-size: 14px; line-height: 26px; }
  .sjpanel > .body { flex: 1; min-height: 0; overflow: auto; padding: 0; overscroll-behavior: contain; }
  #recentJobs table.jobsgrid tr:not(:first-child) { cursor: pointer; }   /* a click on a job's row opens it (29 Oct 2026) */
  html.ovl-lock { overflow: hidden; } html.ovl-lock.ovl-gutter { scrollbar-gutter: stable; }
  .sjpanel .recentjobs { max-height: none; overflow: visible; }
  /* a job list's Run time and Started on one line; Project wide enough that only a very long name wraps (Simon, 10 Oct 2026) */
  table.jobsgrid .nw { white-space: nowrap; }
  table.jobsgrid th[data-jsort] { cursor: pointer; user-select: none; }
  table.jobsgrid th[data-jsort]:hover { text-decoration: underline; }
  table.jobsgrid th .jsarrow { margin-left: 4px; font-size: 10px; }
  table.jobsgrid td.proj { min-width: 200px; }
  /* the system's logo (Trend, Delta, Tridium ...): top right of the job page's progress / result card, small in job lists */
  .platlogo { float: right; height: 40px; max-width: 150px; object-fit: contain; margin: 0 0 8px 16px; padding: 4px 8px;
    border-radius: 6px; box-sizing: content-box; }
  #jobBody #prog { display: flow-root; }
  .platmini { height: 14px; max-width: 44px; object-fit: contain; vertical-align: -2px; margin-left: 6px; padding: 1px 3px;
    border-radius: 3px; }
  @media (max-width: 600px) { .platlogo { height: 28px; max-width: 96px; margin-left: 10px; } }
  /* several systems on one job: each logo (up to 3), side by side; the page heading's a little larger than a list's */
  td.task .platmini + .platmini, td.jlogos .platmini + .platmini { margin-left: 3px; }
  /* the job's logos at the END of its row, right-aligned (Simon, 29 Oct 2026, batch 13) */
  table.jobsgrid td.jlogos { text-align: right; white-space: nowrap; } table.jobsgrid th.jlogos { width: 1%; }
  table.jobsgrid td.jlogos .platmini:first-child { margin-left: 0; }
  .platmini.plathead { height: 28px; max-width: 120px; vertical-align: -6px; }   /* matches the h1 text (Simon, 20 Oct 2026) */
  /* the system logo AFTER the title (Simon, 30 Oct 2026 - batch 21 item 4: "O&M Manual : 48369 - ... [TREND]") */
  .jobplats:not(:empty) { margin-left: 10px; }
  /* batch 242 item 3 (Simon 9 Nov 2026, 908): the panel sits OVER the menu's tab row (z 31 > the tabs' 29 - it was 21, so the tab row covered
     its title row and Refresh / close), and its table fits the panel - no sideways scroll at a normal width, so the Started column and the
     "n of N" count are never cut; narrower, the cells wrap and the Run time / system logo columns give way before anything is cut off */
  .sjpanel table.jobsgrid { width: 100%; }
  .sjpanel table.jobsgrid td.proj { min-width: 180px; } .sjpanel table.jobsgrid td.task { min-width: 100px; }
  /* wider (Simon, 14 Oct 2026: "stop the wrap around text"): Task, Status, Run time and Started on one line, Project takes the rest */
  @media (min-width: 701px) { .sjpanel table.jobsgrid td.task, .sjpanel table.jobsgrid .chip, .sjpanel table.jobsgrid th { white-space: nowrap; }
    .sjpanel table.jobsgrid th { width: 1%; } .sjpanel table.jobsgrid th.proj { width: auto; }
    .sjpanel table.jobsgrid th[style*="150px"] { width: 120px !important; } .sjpanel .pbar { min-width: 100px; } }
  @media (min-width: 701px) and (max-width: 1360px) { .sjpanel table.jobsgrid td.task, .sjpanel table.jobsgrid .chip, .sjpanel table.jobsgrid th { white-space: normal; }
    .sjpanel table.jobsgrid td.proj { min-width: 120px; } .sjpanel .pbar { min-width: 70px; } .sjpanel table.jobsgrid th[style*="150px"] { width: 90px !important; } }
  @media (min-width: 701px) and (max-width: 900px) { .sjpanel table.jobsgrid th.jlogos, .sjpanel table.jobsgrid td.jlogos, .sjpanel table.jobsgrid th:nth-last-child(3),
    .sjpanel table.jobsgrid td:nth-last-child(3) { display: none; } }
  body.sj-on main { padding-right: 56px; }
  @media (max-width: 700px) { .sjpanel { right: 0; width: 100vw; border-radius: 0; z-index: 56; } body.sj-on main { padding-right: 40px; }
    .sjpanel table.jobsgrid td.task, .sjpanel table.jobsgrid .chip, .sjpanel table.jobsgrid th { white-space: normal; } .sjpanel table.jobsgrid td.nw { white-space: normal; }
    .sjpanel table.jobsgrid td.proj { min-width: 90px; } .sjpanel table.jobsgrid td.task { min-width: 0; } .sjpanel table.jobsgrid tr > :first-child { min-width: 0 !important; }
    .sjpanel table.jobsgrid th.jlogos, .sjpanel table.jobsgrid td.jlogos { display: none; }
    .sjpanel .pbar { min-width: 56px; } .sjpanel table.jobsgrid th[style*="150px"] { width: 70px !important; }
    .sjpanel table.jobsgrid th:nth-last-child(3), .sjpanel table.jobsgrid td:nth-last-child(3), .sjpanel table.jobsgrid th:nth-last-child(4),
    .sjpanel table.jobsgrid td:nth-last-child(4) { display: none; }   /* Progress and Run time give way; Started (the last column shown) stays */
    .sjpanel table.jobsgrid { font-size: 12.5px; } .sjpanel table.jobsgrid th, .sjpanel table.jobsgrid td { padding-left: 5px; padding-right: 5px; }
    .sjpanel .jfbar > * { min-width: 0; flex: 1 1 40%; } .sjpanel .jfbar { padding: 6px; } .sjpanel .jfbar [data-jfn] { flex: none; } }
  @media (prefers-reduced-motion: reduce) { .sjpanel, .sjpanel.open { transition: none; } .sjbar .dot.run { animation: none; } }
  /* ---- Accounts: a user's activity (Simon, 14 Oct 2026) - Recent jobs' slide-out panel, over it at the right edge */
  .uapanel { right: 0; z-index: 57; width: min(1000px, 94vw); }
  .uabody { padding: 12px 16px 18px; } .uabody h3 { margin: 18px 0 6px; font-size: 15px; color: var(--link); } .uabody h3:first-child { margin-top: 0; }
  .uabody .uahead { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; } .uabody .uahead .grow { flex: 1; }
  .uabody .tblscroll { margin-bottom: 4px; } .uabody table.grid { font-size: 13px; }
  .uabody .chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0 8px; }
  .uabody .livel { font: 12px/1.45 var(--mono, ui-monospace, Consolas, monospace); max-height: 300px; overflow: auto; border: 1px solid var(--grid); border-radius: 6px; padding: 6px 8px; }
  .uabody .livel div { white-space: pre-wrap; overflow-wrap: anywhere; } .uabody .livel .warn { color: var(--warn); } .uabody .livel .err { color: var(--alarm); }
  @media (max-width: 700px) { .uapanel { width: 100vw; } .uabody { padding: 10px; } .uabody table.jobsgrid { min-width: 640px; } }
  /* users rows: click for their activity; drag onto another account (or Move... on a phone) */
  table.usersgrid tr.urow { cursor: pointer; } table.usersgrid tr.urow:hover td { background: color-mix(in srgb, var(--link) 6%, transparent); }
  table.usersgrid tr.urow.dragging td { opacity: .4; }
  table.usersgrid td.uacts { white-space: nowrap; } table.usersgrid td.uacts button { margin: 1px 2px 1px 0; }
  /* ---- a job's update (failed / ready to check / complete): a card bottom-right above Feedback, newest at the bottom */
  .jobnotes { position: fixed; right: 18px; bottom: 92px; z-index: 47; display: flex; flex-direction: column; gap: 10px;
    width: min(360px, calc(100vw - 32px)); pointer-events: none; }
  body.sj-on .jobnotes { right: 40px; }
  .jobnote { pointer-events: auto; margin: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); animation: jnin .25s ease-out; transition: opacity .2s, transform .2s; }
  .jobnote > h2 { padding: 7px 8px 7px 14px; font-size: 14px; }
  .jobnote > h2 .x { margin-left: auto; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; font-size: 14px; line-height: 26px; }
  .jobnote > .body { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 3px; }
  .jobnote .task { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  .jobnote .ttl { font-weight: 600; overflow-wrap: anywhere; }
  .jobnote .acts { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
  .jobnote.gone { opacity: 0; transform: translateX(24px); }
  @keyframes jnin { from { opacity: 0; transform: translateY(10px); } }
  @media (max-width: 700px) { .jobnotes, body.sj-on .jobnotes { right: 16px; } }
  /* ---- Home, "Fit the task tiles to the page" (Your account): the stages scaled as one so they fill the width and fit
     the window's height - each stage one row, the same columns in every row (zoom keeps clicks and drops on the tiles) */
  .stagewrap.fit .stage .tiles { grid-template-columns: repeat(var(--fitcols, 6), minmax(0, 1fr)); }
  .stagewrap.fit .stage:last-child { margin-bottom: 0; }
  /* fitted, a tile is its title and tag (Coming soon / Beta) - the description is its tooltip, the drop hint shows only
     while files are being gathered or read - so the tiles come out larger and the titles readable (Simon, 10 Oct 2026) */
  .stagewrap.fit .tile > p, .stagewrap.fit .tile:not(.gathering):not(.busy):not(.over) .dropmsg { display: none; }
  .stagewrap.fit .tile h3 { font-size: 17px; line-height: 1.25; margin-bottom: 2px; }
  .stagewrap.fit .tile .tagrow { margin: 2px 0 0; }
  body.fit-home main { padding-bottom: 14px; }
  @media (max-width: 700px) { header.top .brandtext, header.top .who .btn-pw { display: none; } nav.tabs { overflow-x: auto; }
    main { padding: 18px 16px 50px; } }
  /* floating Save (as BMS AR): appears once something on the page has changed */
  #view button.savehidden { display: none; }
  .asstatus { margin-left: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; } .asstatus.bad { color: var(--alarm); }
  .asstatus a { color: inherit; text-decoration: underline; } #view input.invalid, #view textarea.invalid { outline: 2px solid var(--alarm); outline-offset: -1px; }
  .savefab { position: fixed; right: 18px; bottom: 44px; z-index: 21; display: none; align-items: center; gap: 10px; padding: 16px 30px; border-radius: 34px;
    background: var(--blue); color: var(--on-primary); border: 3px solid var(--mint); font: 700 18px var(--head); letter-spacing: .2px;
    box-shadow: 0 8px 26px rgba(0,0,0,.32), 0 0 0 0 var(--mint); cursor: pointer; }
  .savefab .ic { font-size: 22px; }
  .savefab.on { display: inline-flex; animation: fabin .25s ease-out, fabpulse 2.2s ease-in-out .3s infinite; }
  .savefab:hover { background: var(--blue-dark); transform: translateY(-1px); animation: none; }
  @keyframes fabin { from { transform: translateY(12px); opacity: 0; } }
  @keyframes fabpulse { 50% { box-shadow: 0 8px 26px rgba(0,0,0,.32), 0 0 0 7px color-mix(in srgb, var(--mint) 45%, transparent); } }
  /* maintenance: the holding screen (everyone; administrators can carry on working with the strip along the top) */
  #maint { position: fixed; inset: 0; z-index: 9000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
  #maint .box { max-width: 520px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 26px; text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,.08); }
  #maint h1 { margin: 14px 0 8px; font-size: 22px; }
  /* the Studio logo flares like the sign-in hub (Simon 23 Oct 2026: "make the logo do the glow thing"): the base logo stays
     crisp, a lit copy on top and a halo behind it run on the hub's own hubflare, same colours and 6 s timing */
  #maint .mlogo { position: relative; display: inline-block; vertical-align: top; isolation: isolate; }
  #maint .mlogo img { display: block; height: 64px; }
  #maint .mlogo img.lit { position: absolute; inset: 0; height: 100%; opacity: 0; pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(225, 234, 255, .95)) drop-shadow(0 0 18px rgba(169, 193, 255, .8)); animation: hubflare 6s linear infinite; }
  #maint .mlogo::after { content: ''; position: absolute; left: 50%; top: 50%; width: 170px; height: 170px; transform: translate(-50%, -50%); z-index: -1;
    border-radius: 50%; background: radial-gradient(circle, rgba(169, 193, 255, .38), transparent 65%); opacity: 0; pointer-events: none; animation: hubflare 6s linear infinite; }
  @media (prefers-reduced-motion: reduce) { #maint .mlogo img.lit, #maint .mlogo::after { animation: none; opacity: 0; } }
  /* batch 206 item 8 (Simon 6 Nov 2026, "add the glowing Shawforge data tree to the Maintenance screen"): the sign-in's
     data tree (signin-flow.png - BMS AR's art) rising out of the card behind the logo, its stem running into the logo; drawn
     through the art as a mask in the theme's blue (light) / mint (dark), a faint base and the sign-in's travelling band of
     light (dataflow, 6 s, in step with the logo's hubflare). One image, CSS only; still under prefers-reduced-motion. */
  #maint { --mtw: min(340px, 70vw); overflow: auto; }
  #maint .box { position: relative; isolation: isolate; margin-top: calc(var(--mtw) * 1.12 - 64px); }
  #maint .mtree { position: absolute; left: 50%; bottom: calc(100% - 64px); width: var(--mtw); aspect-ratio: 1024 / 1147;
    transform: translateX(-49.2%); z-index: -1; pointer-events: none; }
  #maint .mtree i { position: absolute; inset: 0; background: var(--blue);
    -webkit-mask: url(/static/brand/signin-flow.png) center bottom / contain no-repeat; mask: url(/static/brand/signin-flow.png) center bottom / contain no-repeat; }
  #maint .mtree .base { opacity: .22; }
  #maint .mtree .glow { background: linear-gradient(to top, transparent 38%, var(--blue) 47%, var(--blue) 53%, transparent 62%) 0 100% / 100% 300% no-repeat;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--mint) 90%, transparent)); animation: mtreeflow 6s linear infinite; }
  @keyframes mtreeflow { from { background-position: 0 100%; } to { background-position: 0 0%; } }
  :root[data-base=dark] #maint .mtree i { background-color: var(--mint); }
  :root[data-base=dark] #maint .mtree .glow { background: linear-gradient(to top, transparent 38%, var(--mint) 47%, var(--mint) 53%, transparent 62%) 0 100% / 100% 300% no-repeat; }
  #maint .box > :not(.mtree) { position: relative; }
  @media (max-height: 760px) { #maint { --mtw: min(220px, 60vw); } }
  @media (max-height: 560px) { #maint { --mtw: 0px; } #maint .mtree { display: none; } }
  @media (prefers-reduced-motion: reduce) { #maint .mtree .glow { animation: none; opacity: 0; } #maint .mtree .base { opacity: .3; } }
  #maint .mbar { height: 22px; margin: 18px auto 4px; max-width: 360px; } #maint .mbar span { line-height: 20px; }
  #maint .mstage { margin: 4px 0 8px; color: var(--link); }
  #maint .spin { width: 34px; height: 34px; margin: 16px auto 4px; border: 3px solid var(--line); border-top-color: var(--link); border-radius: 50%; animation: mspin 1s linear infinite; }
  @keyframes mspin { to { transform: rotate(360deg); } }
  #maint ul { text-align: left; margin: 12px 0 0; padding-left: 18px; }
  #maintBar { position: fixed; top: 0; left: 0; right: 0; z-index: 8000; background: var(--warn); color: #fff; font-size: 13px; padding: 6px 16px;
    display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* Click a column title to sort (js/tablesort.js - Simon, 20 Nov 2026) */
table.ts th.tsh { cursor: pointer; user-select: none; }
table.ts th.tsh:hover { text-decoration: underline; }
table.ts th .tsarrow { margin-left: 4px; font-size: 10px; }
