/* The screens' content: tables, the Now floor (counts, In the app, Checks), the
   pane an account, a new access, a plugin or a plan opens in beside its list, and the forms inside it.
   Tokens and controls: style.css; the frame (gate, rail, screen head, the grid the pane sits in):
   frame.css. */

/* Tables: one text size; rank is weight and colour. ---------------------------------------------- */

.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--ground);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.grid td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.grid-main th:first-child, .grid-main td:first-child { padding-left: var(--pad); }
.grid-main th:last-child, .grid-main td:last-child { padding-right: var(--pad); }
.grid .num { text-align: right; }
.grid th[data-sort], .grid-main th[data-sort]:first-child { padding: 0; }
.sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
.grid-main th[data-sort]:first-child .sort { padding-left: var(--pad); }
.num .sort { justify-content: flex-end; }
.sort:hover, th[aria-sort] .sort { color: var(--text); }
.sort .icon { opacity: 0.3; transition: opacity 150ms var(--ease), transform 150ms var(--ease); }
.sort:hover .icon { opacity: 0.7; }
th[aria-sort] .sort .icon { opacity: 1; color: var(--accent); }
th[aria-sort="ascending"] .sort .icon { transform: rotate(180deg); }
.grid tbody tr { transition: background-color 150ms var(--ease); }
.grid tbody tr:hover > td { background: rgb(255 255 255 / 0.025); }
.grid tr.is-inactive > td { color: var(--text-3); }
.grid .row { cursor: pointer; }
.grid tr.is-open > td, .grid tr.is-open:hover > td { background: var(--accent-wash); }
/* Secondary words keep their contrast on an open row's gold wash. */
.grid tr.is-open .muted { color: var(--text-2); }

.cell-stack { display: grid; gap: 1px; min-width: 0; }
.cell-stack .muted, .cell-stack .link { overflow: hidden; text-overflow: ellipsis; }
.cell-stack .link { display: block; max-width: 100%; white-space: nowrap; }
/* The Discord account under an email: its display name, then @username in the muted colour. */
.discord-line { overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.cell-account { max-width: 300px; }
.cell-account .primary, .cell-who .primary { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; }
.link.primary { font-weight: 600; }
.cell-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.cell-notes { min-width: 220px; max-width: 520px; color: var(--text-2); white-space: normal !important; }
.cell-actions { width: 1%; text-align: right; }
.cell-actions .btn + .btn { margin-left: 6px; }
.cell-mono { color: var(--text-2); font-family: var(--mono); font-size: 12.5px; font-variant-ligatures: none; }
.one-line { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.primary-text { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; }
.computer-account-mobile { display: none; overflow: hidden; text-overflow: ellipsis; }
.version { color: var(--text-3); font-family: var(--mono); font-size: 12px; font-weight: 400; font-variant-ligatures: none; }
.soon { color: var(--warn); }
.ends-soon { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); }

.grid .empty td, .grid .empty:hover td { padding: 40px var(--pad); background: none; color: var(--text-2); white-space: normal; }
.empty-body { display: grid; justify-items: start; gap: 6px; max-width: 60ch; }
.empty-body .icon { color: var(--text-3); }
.empty-body strong { color: var(--text); font-weight: 600; }

.skeleton td { padding-top: 14px; padding-bottom: 14px; }
.skeleton .bar {
  display: block;
  width: 70%;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--raise) 0%, #262322 50%, var(--raise) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* A form or question opened in a row: under the row it acts on. */
.grid .panel-row > td, .grid .panel-row:hover > td { padding: 4px 12px 14px; background: var(--accent-wash); white-space: normal; cursor: default; }
.grid-main .panel-row > td { padding-left: var(--pad); padding-right: var(--pad); }

/* The Now floor ---------------------------------------------------------------------------------- */

.floor { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px; padding: 18px var(--pad) var(--pad); }

.tallies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--raise);
  overflow: clip;
}
.tally {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 12px;
  padding: 14px 18px 15px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 150ms var(--ease);
}
.tally:first-child { border-left: 0; }
.tally:hover { background: var(--raise-2); }
.tally:focus-visible { outline-offset: -2px; }
.tally[aria-pressed="true"] { background: var(--accent-wash); }
.tally.changed { animation: wash 2200ms var(--ease); }
.tally-label { grid-column: 1 / -1; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.tally-value { font: 600 30px/1.1 var(--font-display); letter-spacing: -0.01em; }
.tally-note { color: var(--text-3); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tally.is-bad .tally-value { color: var(--bad-text); }
.tally.is-warn .tally-value { color: var(--warn); }
.tally.is-zero .tally-value { color: var(--text-3); }
.tally.is-link .tally-note { color: var(--accent); }
.tally.is-link:hover .tally-note { color: var(--accent-hi); }

.floor-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); grid-template-rows: minmax(240px, 1fr); gap: 16px; min-height: 0; }

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--raise);
  overflow: clip;
}
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 13px 16px 12px; }
.panel-head h2 { font-size: 15px; }
.panel-note { color: var(--text-3); font-size: 12.5px; }
/* A panel whose head carries controls keeps them at the end, or at the start of their own line. */
.panel-head:has(.filters) { justify-content: space-between; }
.panel-scroll { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--line); }
.panel .grid th { background: var(--raise); }
.panel .grid th:first-child, .panel .grid td:first-child { padding-left: 16px; }
.panel .grid th:last-child, .panel .grid td:last-child { padding-right: 16px; }
.panel .grid tbody tr:last-child > td { border-bottom: 0; }
.panel .grid .empty td { padding: 28px 16px; }
.floor .grid td { padding-top: 8px; padding-bottom: 8px; }
.panel-foot .link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
/* A clamped list's foot fills what the whole rows leave, so the panel keeps its place on the floor. */
.panel-foot { display: flex; flex: 1 0 37px; align-items: center; padding: 0 16px; border-top: 1px solid var(--line); }
.panel-foot.is-end .icon { transform: rotate(180deg); }
.ip { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
/* A computer in the app: its name, cut (whole in the pane), over its Windows user and OS; its account's
   email over the game on it. */
.cell-computer { min-width: 176px; max-width: 260px; }
.cell-computer .cell-name { min-width: 0; max-width: 100%; }
.cell-computer .cell-name > :is(.link, .primary-text) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cell-email .cell-stack > span { overflow: hidden; text-overflow: ellipsis; }
.game-line { color: var(--text-2); }
.game-line strong { color: var(--text); font-weight: 600; }
.cell-app { max-width: 220px; }
/* On a board of the last 15 minutes App check is the least of the columns: below 1500 px it is the
   computer name's description, and the IP keeps its place; below 1360 px the email and the IP cut
   sooner (each whole in its title). */
@media (max-width: 1499px) and (min-width: 1101px) {
  .col-last { display: none; }
}
@media (max-width: 1360px) and (min-width: 1101px) {
  .cell-email { max-width: 132px; }
  .ip { max-width: 104px; }
  .floor .grid td, .floor .grid th { padding-left: 10px; padding-right: 10px; }
}

.filters-sm .pill-face { height: 26px; padding: 0 9px; font-size: 12px; }

.grid-checks .time { width: 1%; color: var(--text-2); }
/* Who takes the width the answer leaves, cutting a long email with an ellipsis. */
.grid-checks .cell-who { width: 100%; max-width: 0; }
.answer { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.reason { color: var(--info); font-size: 12px; font-weight: 600; }

/* The signature: a refresh that changes a value flips that cell once and washes it gold. */
.flip { display: inline-block; animation: flip 640ms var(--ease); transform-origin: 50% 40%; }
.grid td.changed, .tally.changed { animation: wash 2200ms var(--ease); }
.grid tr.arrived > td { animation: arrive 900ms var(--ease); }
@keyframes flip { 0% { opacity: 0.15; transform: perspective(240px) rotateX(-88deg); } 55% { opacity: 1; } 100% { transform: none; } }
@keyframes wash { from { background-color: rgb(233 164 58 / 0.2); } }
@keyframes arrive { from { opacity: 0; background-color: rgb(233 164 58 / 0.16); transform: translateY(-4px); } }
/* Without motion the change still shows: a steady gold tint until the next refresh. */
@media (prefers-reduced-motion: reduce) {
  .grid td.changed, .tally.changed, .grid tr.arrived > td { background-color: rgb(233 164 58 / 0.12); }
}

/* The pane: the thing being worked on, beside the list it came from. ----------------------------- */

.pane {
  display: flex;
  flex-direction: column;
  grid-area: 1 / 2;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: #1c1a19;
  animation: pane-in 200ms var(--ease);
}
.pane:focus { outline: none; }
@keyframes pane-in { from { opacity: 0; transform: translateX(12px); } }
.pane-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 12px; padding: 20px 20px 16px 24px; border-bottom: 1px solid var(--line); }
.pane-back { display: none; }
.pane-title { display: grid; gap: 4px; min-width: 0; }
.pane-title h2 { font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.pane-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--text-2); }
.pane-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 24px 28px; }
.pane-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--raise); }
.pane-wait { padding: 18px 0; }

/* Beside the pane a list keeps its key columns: the ones marked wide wait until it closes. Its first
   and last shown cells keep the screen's gutter (a sortable head's button carries its own). */
.with-pane .col-wide { display: none; }
.with-pane .grid-main :is(th:not([data-sort]), td):not(.col-wide):not(:not(.col-wide) ~ *) { padding-left: var(--pad); }
.with-pane .grid-main :is(th:not([data-sort]), td):not(.col-wide):not(:has(~ :not(.col-wide))) { padding-right: var(--pad); }

.section { display: grid; gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; }
.section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.section-head h3 { margin-right: auto; color: var(--text); font-size: 14px; }
.section-note { color: var(--text-3); font-size: 12.5px; }
/* A section that opens in place (the pane's Plugins): the heading is the button, its count and a
   chevron (up while open) after it, so its text lines up with the other sections' headings. */
.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: -4px -8px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 150ms var(--ease);
}
.section-toggle:hover { background: var(--raise-2); }
.section-toggle .icon { color: var(--text-3); transition: transform 150ms var(--ease); }
.section-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.section-count { color: var(--text-3); font-size: 12px; font-weight: 600; }

.status-line { display: grid; gap: 12px; padding: 18px 0 2px; }
.status-sentence { color: var(--text-2); font-size: 14px; line-height: 1.55; max-width: 62ch; }
.status-sentence strong { color: var(--text); font-weight: 600; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.facts dt { color: var(--text-3); font-size: 12.5px; }
.facts dd { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; min-width: 0; overflow-wrap: anywhere; }

/* An account's plugins and its computers: one block each (a plugin's actions beside it, its form under
   it). */
.plugin-list, .computer-list { display: grid; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-l); list-style: none; overflow: hidden; }
.plugin-item, .computer-item { display: grid; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--raise); }
.plugin-item:first-child, .computer-item:first-child { border-top: 0; }
.plugin-item.is-open { background: color-mix(in srgb, var(--accent) 5%, var(--raise)); }
.plugin-line, .computer-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.plugin-name, .computer-name { font-weight: 600; }
.computer-name { min-width: 0; overflow-wrap: anywhere; }
.computer-line .chip { margin-left: auto; }
.plugin-end { color: var(--text-2); }
.plugin-meta { color: var(--text-3); font-size: 12.5px; }
.plugin-actions { display: flex; gap: 4px; margin-left: auto; }

/* Time left on a plugin: a meter against 90 days; a clock not started is dashed, no end runs off. */
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--frame); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: color-mix(in srgb, var(--accent) 70%, var(--frame)); }
.meter.is-soon .meter-fill { background: var(--warn); }
.meter.is-ended .meter-fill { width: 0; }
.meter.is-unstarted { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.meter.is-unstarted .meter-fill { background: transparent; border: 1px dashed var(--accent-line); }
.meter.is-none .meter-fill { width: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, var(--frame)) 80%, transparent); }
.meter.is-off .meter-fill { background: var(--text-3); opacity: 0.45; }
.meter-ghost { position: absolute; top: 0; bottom: 0; border-radius: 0 3px 3px 0; background: rgb(233 164 58 / 0.35); box-shadow: inset 0 0 0 1px var(--accent); }

/* Forms in the pane or a row. */
.action-form { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r-l); background: var(--ground); }
.action-form .form-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.action-form .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.action-form .hint { color: var(--text-3); font-size: 12.5px; }
.action-form .preview { color: var(--text-2); }
.action-form .preview strong { color: var(--accent); font-weight: 600; }
/* Merge accounts' pick of the other account: a field no wider than its longest likely label. */
.merge-pick { max-width: 480px; }
.confirm-text { color: var(--text-2); max-width: 62ch; }
.confirm-text strong { color: var(--text); }
.danger { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { display: grid; gap: 8px; }
.slot:empty { display: none; }

.pane-form { display: grid; gap: 18px; padding-top: 18px; }
.pane-form .field input:not([type="checkbox"]):not([type="radio"]) { max-width: 420px; }

/* The plugins New access, Give and a plan hand out: All plugins, or a pick from the catalog, with
   Select all, Clear and how many are picked. */
.plugin-pick { display: grid; gap: 10px; }
.pick-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pick-count { margin-left: auto; color: var(--text-3); font-size: 12.5px; }
/* Whole, in the pane that scrolls: no scroll inside a scroll, no row cut through. */
.pick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--field);
}
.pick-list .check { font-weight: 400; }

/* Names and IPs: a notice when the account looks shared, then every name and network. */
.shared-note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid rgb(240 145 58 / 0.35); border-radius: var(--r); background: rgb(240 145 58 / 0.07); color: var(--text-2); }
.shared-note .icon { margin-top: 1px; color: var(--warn); }
.sightings { border: 1px solid var(--line); border-radius: var(--r-l); overflow: auto; }
.sightings .grid th { position: static; background: var(--raise); }
.sightings .grid td, .sightings .grid th { padding: 8px 10px; }
.sightings .grid td.cell-mono { min-width: 128px; white-space: normal; word-break: break-all; }
.sightings .grid th:first-child, .sightings .grid td:first-child { padding-left: 12px; }
.sightings .grid tbody tr:last-child > td { border-bottom: 0; }

.link-text {
  max-width: 340px;
  padding: 6px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--field);
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.toolbar-note { max-width: 70ch; color: var(--text-3); font-size: 12.5px; }

/* Narrow windows ---------------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .col-opt { display: none; }
  .link-text { display: none; }
}

@media (max-width: 1180px) and (min-width: 1101px), (max-width: 760px) {
  .col-ip { display: none; }
}

/* Stacked, the floor is as tall as its panels and the screen scrolls; each list scrolls past 480 px. */
@media (max-width: 1100px) {
  .floor { grid-template-rows: auto auto; }
  .floor-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .floor-grid, .floor .panel { min-height: auto; }
  .floor .panel-scroll { flex: none; max-height: 480px; }
}

/* Narrow windows show the pane in the list's place, with a link back to it. */
@media (max-width: 939px) {
  .main.with-pane { grid-template-columns: minmax(0, 1fr); }
  .main.with-pane > .screen { display: none; }
  .pane { grid-column: 1; border-left: 0; }
  .pane-back { display: inline-flex; grid-column: 1 / -1; justify-self: start; margin: -6px 0 2px -10px; }
  .pane-close { display: none; }
}

/* Phones: each row keeps its key fact and its action; the rest is one tap away in the pane. */
@media (max-width: 640px) {
  .col-player, .col-seen, .col-account, .col-last { display: none; }
  .grid td, .grid th { padding-left: 8px; padding-right: 8px; }
  .grid th[data-sort] { padding: 0; }
  .sort { padding: 9px 8px; }
  .cell-account { min-width: 136px; max-width: 150px; }
  .cell-computer { min-width: 0; }
  .computer-account-mobile { display: block; }
  .cell-email .one-line { flex-wrap: wrap; row-gap: 4px; white-space: normal; }
  .cell-email { max-width: none; }
  .pane-head { padding: 14px var(--pad) 12px; }
  .pane-body { padding: 4px var(--pad) 24px; }
  .pane-foot { padding: 12px var(--pad); }
  /* A list wider than the phone scrolls sideways: a row's buttons stack, and the form opened under a
     row stays in view, as wide as the screen. */
  .cell-actions .btn { display: flex; width: 100%; }
  .cell-actions .btn + .btn { margin: 6px 0 0; }
  .grid-main .panel-row .action-form { position: sticky; left: var(--pad); max-width: calc(100vw - 2 * var(--pad)); }
}

@media (max-width: 760px) {
  .tallies { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tally:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .pick-list { grid-template-columns: minmax(0, 1fr); }
}
