/* The shell, and what panel.css does not already have.

   Everything structural that was always shared - tokens, cards, tables, chips, the phone card
   layout, the thin scrollbars, the 16px inputs - comes from panel.css, which the page loads first
   and the legacy /admin/ page loads too. This file adds the app shell (a menu of screens and a
   pane of content) and the widgets' own parts: the pause banner, the limit meters, the operator
   screens' column choices.

   It is named after the page it was written for, which was deleted on 2026-09-21 (card d59); the
   client panel loads it as /next/me.css and it is shared, not dead. It loads after panel.css, so
   where the shell needs a different answer it simply says so here and panel.css is left alone. */

/* ---------------------------------------------------------------- the app shell
   The rail never scrolls away and the content scrolls in its own box. That is the whole difference
   between a page with tabs and a shell with widgets: on a phone the way back to the other windows
   has to be under the thumb at all times, not one flick of scrolling above the top of the screen. */
/* The icon sprite is a real <svg> in the document - that is what lets a rail entry reference a
   <symbol> by name - and an <svg> with no size is 300x150 of empty box at the top of the page. It
   has no business taking any: nothing is ever drawn from it directly, only referenced. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

html, body { height: 100%; }
body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
header { flex: none; }
#shell { flex: 1 1 auto; display: flex; min-height: 0; }
#content { flex: 1 1 auto; min-width: 0; overflow-y: auto; overscroll-behavior-y: contain;
           padding: 4px 20px 40px; }
#panes { max-width: 1400px; }
/* Anything the shell hides stays hidden. A class selector like `.pane { display: block }` beats
   the browser's own `[hidden] { display: none }`, so without this the panes never disappear: each
   widget you open is simply drawn under the last one. It applies to every element the shell
   toggles - panes, the login row, the pause banner, the new-key box - so the next element to grow
   a display rule cannot quietly bring the bug back. */
[hidden] { display: none !important; }

.pane { display: block; }
#msg { margin-top: 18px; }

/* The rail. #rail is the frame - it carries the shading - and #railscroll the scroller inside it,
   exactly the arrangement the tab strip used, so the shading stays at the edge while the entries
   slide under it. */
#rail { position: relative; flex: none; border-right: 1px solid var(--line);
        background: var(--bg); min-width: 0; }
#railscroll { display: flex; flex-direction: column; gap: 2px; height: 100%;
              overflow-y: auto; overscroll-behavior-y: contain; padding: 8px 6px;
              width: 206px; }
#railscroll button { display: flex; align-items: center; gap: 10px; width: 100%;
                     border: none; border-left: 2px solid transparent; border-radius: 0 7px 7px 0;
                     background: none; color: var(--muted); padding: 9px 10px;
                     white-space: nowrap; text-align: left; min-height: 40px; }
#railscroll button:hover { color: var(--fg); background: var(--card); }
#railscroll button.on { color: var(--accent); border-left-color: var(--accent); background: var(--card); }
#railscroll svg { flex: none; width: 19px; height: 19px; pointer-events: none;
                  fill: none; stroke: currentColor; stroke-width: 1.7;
                  stroke-linecap: round; stroke-linejoin: round; }
/* Icons alone once the names stop fitting - tabs.js measures and sets this class, so the names
   survive wherever there is room for them and no width is hardcoded. */
#railscroll.icons { width: 58px; padding: 8px 5px; }
#railscroll.icons button { justify-content: center; padding: 10px 6px; border-radius: 8px;
                           border-left: none; border-right: 2px solid transparent; }
#railscroll.icons button.on { border-left: none; border-right-color: var(--accent); }
#railscroll.icons .rail-label { display: none; }
#railscroll.icons svg { width: 21px; height: 21px; }
/* The rail's own scrollbar would sit on top of the icons, and the shading - not a scrollbar - is
   what the owner reads as "there is more". It is the one scroller drawn without one. */
#railscroll { scrollbar-width: none; }
#railscroll::-webkit-scrollbar { display: none; }
#rail::before, #rail::after {
  content: ""; position: absolute; left: 0; right: 1px; height: 30px; pointer-events: none;
  opacity: 0; z-index: 2; }   /* no transition: it must be there the instant the thumb moves, and
                                 a half-faded edge is impossible to screenshot or to check */
/* Black, not var(--bg): a gradient the colour of the background is invisible against it, and what
   has to be visible is the edge itself, not just the half-entry under it. */
#rail::before { top: 0; background: linear-gradient(to bottom, var(--edge), transparent); }
#rail::after { bottom: 0; background: linear-gradient(to top, var(--edge), transparent); }
#rail.more-up::before, #rail.more-down::after { opacity: 1; }

/* The widget's own title. The rail already says which widget is open, so this is the second line
   of that answer and stays quiet; on a phone it goes entirely. */
.panetitle { font-size: 15px; margin: 14px 0 4px; }

/* ---------------------------------------------------------------- key-holder widgets */

/* The operator's pause notice. Loud, above every widget, because it is the answer to "why is
   nothing working" and a caller who misses it goes looking in their own code instead. */
.banner { margin: 10px 0 0; padding: 10px 14px; border: 1px solid var(--bad); border-radius: 8px;
          background: var(--card); color: var(--bad); }
.banner b { display: block; }
.banner small { color: var(--muted); }

/* A chip that is only read - a word on a key, a scope on the holder's own overview - drawn like
   the ones that are ticked, with no checkbox and no pointer. */
.chip.static { cursor: default; }
.chip.static:not(.on):hover { border-color: var(--line); }
.chip.static.off { color: var(--muted); opacity: .6; }

/* Limits with today's consumption against them. A number on its own ("rpd 2000") says nothing
   about whether you are near it; the bar is the whole point of the row. */
.meters { display: grid; gap: 6px; }
.meter { display: grid; grid-template-columns: 172px minmax(60px, 1fr) auto; gap: 6px 12px;
         align-items: center; padding: 8px 12px; background: var(--card);
         border: 1px solid var(--line); border-radius: 8px; }
.mname { display: flex; flex-direction: column; min-width: 0; }
.mname b { font-weight: 600; }
.mname small { color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar.hot > span { background: var(--bad); }
.mval { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mval small { color: var(--muted); }
/* A limit of 0 means "no limit" everywhere in gpulm. Said in words, because a zero read literally
   is the opposite of what it means and that is a bad thing to guess wrong about. */
.mfree { color: var(--muted); grid-column: 2 / -1; }

/* A value with no meter behind it: an output cap, a queue timeout, a prompt ceiling. */
.mplain { grid-column: 2 / -1; font-variant-numeric: tabular-nums; }
.mplain small { color: var(--muted); }

/* A model card carries two footnotes - what it costs and whether it is ready - and <small> is
   inline, so without this they run together into one unreadable line. */
.card small { display: block; }
/* A card's footnote is muted by default and has to out-rank that to carry a state colour. */
.card .chips { margin-top: 4px; }
.card small.ok { color: var(--ok); }
.card small.bad { color: var(--bad); }

/* Column alignment comes from .num in panel.css, on the headers and the cells alike. */
#myqueue td:first-child { white-space: nowrap; }

/* ---------------------------------------------------------------- operator widgets
   The two figure tables the operator reads carry .numtable, so panel.css's phone treatment (a real
   table, small type, pinned header) applies to them by name. What is left is which columns each
   can afford to lose on a phone, which is per table. */
#ledger td:nth-child(2) .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskpri { font: inherit; padding: 1px 4px; border: 1px solid var(--line); border-radius: 5px;
           background: var(--card); color: var(--muted); min-height: 28px; }
.mdh { margin: 14px 0 6px; font-size: 14px; font-weight: 600; line-height: 1.3; }
/* A fenced block is something he copies, so it scrolls sideways rather than wrapping, and the copy
   button sits OUTSIDE the <pre> so it is not dragged over by a selection of the code. */
.mdcode { position: relative; margin: 10px 0; }
.mdcode pre { margin: 0; overflow-x: auto; background: var(--bg); border: 1px solid var(--line);
              border-radius: 6px; padding: 9px 11px; }
.mdcode pre code { background: none; border: 0; padding: 0; font-size: 12.5px;
                   /* Room for the button, so a one-line block does not run under it. The padding
                      is on the CODE rather than the PRE so it scrolls away with the text instead
                      of leaving a permanent gutter. */
                   padding-right: 58px; }
/* Opaque, not faded: a long line scrolls UNDER this button, and a translucent one then sits on
   top of the code he is trying to read. The restraint is in the colour, not in the alpha. */
.mdcopy { position: absolute; top: 5px; right: 5px; font-size: 11px; padding: 2px 7px;
          min-height: 24px; background: var(--card); color: var(--muted); }
.mdcode:hover .mdcopy, .mdcopy:focus-visible { color: var(--fg); border-color: var(--accent); }
/* The spoiler. Nesting is expected - the answer at the top, the explanation one click below - so
   each level is indented and ruled, and a summary is a real thumb target. */
.mdfold { margin: 8px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.mdfold > summary { cursor: pointer; padding: 7px 10px; min-height: 22px; font-size: 13px;
                    color: var(--accent); list-style-position: inside; }
.mdfold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mdfoldbody { padding: 0 10px 8px; border-top: 1px solid var(--line); }
.mdfold .mdfold { background: var(--card); }
.mdtable { width: auto; }
.mdtable th { white-space: nowrap; }      /* a column name is short and reads as one line */
.mdmid { text-align: center; }

@media (max-width: 720px) {
  /* Every pixel of header is a pixel of list. Unlocked there are only a name and a Lock button, so
     they share one line; locked, the key field takes a line of its own because it has to be typed
     into. panel.css gives the old page a full-width h1, which the shell cannot afford. */
  header { padding: 8px 12px; gap: 8px; }
  h1 { flex-basis: auto; font-size: 15px; }
  #auth { flex: 1 1 180px; width: auto; justify-content: flex-end; }
  #clientkey { flex: 1 1 100%; min-width: 0; }

  /* A rail of labels is a third of a 360px phone. It goes to icons and stays under the thumb. */
  #content { padding: 0 12px 40px; }
  /* Two cards across what is left beside the rail, rather than one very wide one. */
  .cards { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  #railscroll { width: 54px; padding: 6px 4px; }
  #railscroll button { min-height: 46px; }
  .panetitle { display: none; }

  .meter { grid-template-columns: minmax(0, 1fr) auto; }
  .mname { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .mplain, .mfree { grid-column: 1 / -1; }
  .banner { margin: 8px 0 0; }

  /* Nine columns of figures do not fit a phone. The agent name and the raw prompt count fold
     away; cached stays, because it is the number this page exists to show. */
  #myreq th:nth-child(2), #myreq td:nth-child(2),
  #myreq th:nth-child(6), #myreq td:nth-child(6) { display: none; }
  /* The model name is the one elastic column, so every figure column keeps its digits. */
  #myreq td:nth-child(3) { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
  #myusage td:first-child { color: var(--muted); }

  /* The operator's telemetry is eleven columns. model, start, prompt, cached and total fold away:
     the phone keeps when, who, the wait, time to first token, tokens out and the rate. */
  #telemetry th:nth-child(3), #telemetry td:nth-child(3),
  #telemetry th:nth-child(5), #telemetry td:nth-child(5),
  #telemetry th:nth-child(7), #telemetry td:nth-child(7),
  #telemetry th:nth-child(8), #telemetry td:nth-child(8),
  #telemetry th:nth-child(11), #telemetry td:nth-child(11) { display: none; }
  #telemetry td:nth-child(2) { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
  /* The ledger is six numbers wide and its names are short. Given all the slack the name column
     took two thirds of the row and squeezed the figures the widget exists for, so it is capped
     instead; the full name stays in the title. */
  #ledger th:nth-child(2), #ledger td:nth-child(2) { width: 1%; }
  #ledger td:nth-child(2) .clip { max-width: 76px; }
  #ledger td:first-child { color: var(--muted); }

  /* A card row's value half is 1fr of a ~260px card, and a scope list ("admin,text,image,gpu") has
     no space in it to break at. Without this it runs off the side of the card. */
  #panes table td[data-label] { overflow-wrap: anywhere; }

  /* A body table that already fits keeps the body's type. .numtable's 10 and 12 px are sized for
     eleven columns of figures, not for two words and a number inside a card. */
  .mdtable th { font-size: 12px; }
  .mdtable td { font-size: 13px; }
}

/* The per-model "copy what an agent needs" button, and the fallback the clipboard refusal path
   prints into the card. */
.copycfg { margin-top: 8px; font-size: 12px; padding: 5px 10px; }
.cfgout { margin: 8px 0 0; padding: 8px; font-size: 11px; line-height: 1.45; overflow-x: auto;
          background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
          white-space: pre; }

/* ------------------------------------------------------------------ the downtime grids
   A square per day for a year, and a square per hour for the last week. The squares are <i>
   elements carrying nothing but a class and a title, so there is no text in them to get wrong and
   nothing built from server data but the title string itself.

   Six steps of colour, tokenised because they have to read in both themes; "no data" is
   deliberately not a colour at all but an empty outline, because a stretch we have no record of
   must not look like a stretch that went well. */
:root { --sq: 11px; --sqgap: 2px;
        --dt0: #d3e8d7; --dt1: #ffd89e; --dt2: #ffa95f; --dt3: #ef6d39; --dt4: #c02c16; }
@media (prefers-color-scheme: dark) {
  :root { --dt0: #1e3c2a; --dt1: #5d4312; --dt2: #8d561c; --dt3: #bc5622; --dt4: #e3533b; }
}

.dtmodel { margin: 16px 0 20px; overflow-x: auto; overflow-y: hidden; }
.dtname { font-weight: 600; margin-bottom: 5px; }
/* One cell per week, one square wide. The month names are longer than that on purpose and are
   allowed to run past their cell, which is what lines each name up with the column its month
   starts in. */
.dtmonths { display: grid; grid-auto-flow: column; grid-auto-columns: var(--sq); gap: var(--sqgap);
            font-size: 9px; line-height: 12px; height: 12px; color: var(--muted); }
.dtmon { white-space: nowrap; }
.dtgrid { display: grid; gap: var(--sqgap); }
.dtgrid.days { grid-auto-flow: column; grid-template-rows: repeat(7, var(--sq));
               grid-auto-columns: var(--sq); }
/* Hours read as a table - an hour of the day across, a day down - and the labels are cells of the
   same grid, so nothing has to be lined up by hand. */
.dtgrid.hours { --sq: 15px; grid-template-columns: max-content repeat(24, minmax(0, 1fr));
                align-items: center; }
.dtlab { font-size: 9px; color: var(--muted); white-space: nowrap; text-align: center; }
.dtlab.row { text-align: right; padding-right: 6px; font-size: 10px; }

.sq { display: block; width: 100%; height: var(--sq); border-radius: 2px;
      border: 1px solid transparent; background: var(--dt0); }
.sq.l0 { background: var(--dt0); }
.sq.l1 { background: var(--dt1); }
.sq.l2 { background: var(--dt2); }
.sq.l3 { background: var(--dt3); }
.sq.l4 { background: var(--dt4); }
.sq.nodata { background: transparent; border: 1px dashed var(--line); }
/* Recorded for part of the period only. Drawn over whatever colour the square already has, so
   "we served everything we saw, but we were not here for all of it" is one square rather than a
   choice between two half-truths. */
.sq.part { background-image: repeating-linear-gradient(45deg, transparent 0 2px,
                             rgba(127, 127, 127, .6) 2px 4px); }

.dtpick { min-height: 1.5em; margin: 10px 0 0; font-size: 13px; }
.dtlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 4px;
            font-size: 12px; color: var(--muted); }
.dtkey { display: inline-flex; align-items: center; gap: 5px; }
.dtkey .sq { width: var(--sq); flex: none; }

@media (max-width: 720px) {
  :root { --sq: 5px; --sqgap: 1px; }
  .dtgrid.hours { --sq: 12px; }
  .dtmonths { font-size: 8px; }
  /* Four columns of a table become a card per row on a phone; the message is the long one. */
  #dtrecent td:nth-child(4) { overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
  /* A whole year has to fit a 360px phone, which is how the owner reads this most of the time.
     The rail takes 56 of those pixels, so 53 weeks get about 270: four pixels and one of gap is
     265 of grid. Small, but a year of reliability is meant to be read as a band at a glance, and
     the alternative - a year you have to swipe through - is not a year at a glance at all. */
  :root { --sq: 4px; }
  .dtmonths { font-size: 7px; }
}

/* ------------------------------------------------------------------ the permission tree
   A picture of the NAMES a product registered, and it is deliberately not drawn like a file tree:
   there are no connecting lines, because a line from a parent to a child says the parent covers
   the child and nothing here does.  The indent is a hint about the name; the full dotted path is
   on every row, because the path is what a rule matches exactly.

   Under 720px the row stacks - name, line, state, buttons - the same way a table row becomes a
   card, and the indent is dropped: on a 360px phone three steps of indent is a third of the width
   spent saying something the path beside it already says. */
.tree { margin: 12px 0 22px; }
.tree > h3 { margin: 0 0 4px; font-size: 14px; }
.treenote { margin: 0 0 10px; font-size: 12px; max-width: 62ch; }
.treelist { list-style: none; margin: 0; padding: 0; }
.treenode + .treenode { margin-top: 4px; }
.treerow { display: grid; align-items: baseline; gap: 2px 12px;
           grid-template-columns: minmax(150px, auto) minmax(0, 1fr) max-content max-content;
           padding: 7px 9px; background: var(--card); border: 1px solid var(--line);
           border-radius: 6px; }
.treename { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.treename b { font-size: 13px; }
.treename code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
                 overflow-wrap: anywhere; }
.treetext { font-size: 12.5px; min-width: 0; overflow-wrap: anywhere; }
.treestate { font-size: 12px; white-space: nowrap; }
.treebuttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.treebuttons button { font-size: 12px; padding: 3px 9px; }
/* The whole reason `requires` is on the wire: on, and the feature is still dark.  It sits under
   the row rather than inside it so it is read as a sentence about the row above it. */
.treewarn { font-size: 12px; padding: 4px 9px 2px; }

@media (max-width: 720px) {
  .treerow { grid-template-columns: minmax(0, 1fr); margin-inline-start: 0 !important; }
  .treewarn { margin-inline-start: 0 !important; }
  .treebuttons { justify-content: flex-start; margin-top: 4px; }
  .treebuttons button { min-height: 40px; }
}
