/*
 * The desk (/): the dotted surface, file icons, their popup (one file or several), the bottom
 * line with the usage ring and the usage popup. Everything is under .desk so nothing leaks into
 * the other screens. desk.js sets positions and widths through element.style (CSSOM), never
 * style="" in markup (CSP).
 */

.desk {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 24px 24px;
  background-position: 12px 12px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  outline: none;
}

.desk.over {
  background-color: var(--accent-tint);
  box-shadow: inset 0 0 0 3px var(--accent);
}

.desk .meta {
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.desk .meta.danger {
  color: var(--danger-ink);
}

/* ───────────── top bar ───────────── */

.desk .desk-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 16px 0 24px;
  pointer-events: none;
}

.desk .desk-bar > * {
  pointer-events: auto;
}

.desk .desk-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.desk .desk-logo {
  display: block;
  width: 40px;
  height: 40px;
  margin-left: -6px;
}

.desk .wordmark {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.desk .desk-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.desk .bar-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
}

.desk a.bar-icon,
.desk a.bar-icon:hover {
  color: var(--ink);
}

.desk .bar-icon:hover {
  background: var(--hover);
}

.desk .desk-pill {
  min-height: 40px;
  padding: 0 14px;
  gap: 6px;
}

.desk .desk-pick {
  padding: 0 16px;
  cursor: pointer;
}

.desk .desk-pick:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The folder picker: only where a folder can be picked, and never on narrow screens. */
.desk .desk-pick-folder[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .desk .desk-pick-folder {
    display: none;
  }
}

/* A smaller round icon button (copy, close). */
.desk .desk-icon-btn {
  width: 40px;
  height: 40px;
}

/* ───────────── file icons ───────────── */

.desk .file-icon {
  position: absolute;
  width: 112px;
  padding: 4px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font: inherit;
  cursor: default;
  touch-action: none;
}

.desk .file-icon .tile {
  padding: 6px 12px;
  border-radius: 12px;
}

.desk .file-icon.sel .tile {
  background: var(--sel-tile);
}

.desk .file-icon.moving {
  opacity: 0.85;
}

.desk .doc {
  position: relative;
  width: 52px;
  height: 64px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--doc);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 1px 2px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9px;
}

.desk .doc::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 15px;
  height: 15px;
  border-radius: 0 9px 0 5px;
  background: linear-gradient(225deg, var(--bg) 50%, var(--fold) 50%);
}

.desk .ext {
  min-width: 30px;
  height: 18px;
  box-sizing: border-box;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-align: center;
}

.desk .k-video .ext {
  background: #2f6fe0;
}

.desk .k-image .ext {
  background: #a85300;
}

.desk .k-doc .ext {
  background: #c93a3f;
}

.desk .k-zip .ext,
.desk .k-other .ext {
  background: #5b5e68;
}

.desk .file-icon.remote .doc {
  opacity: 0.45;
}

.desk .file-icon.failed .doc::after {
  content: '!';
  position: absolute;
  top: -7px;
  right: -9px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.desk .file-icon .label {
  max-width: 108px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desk .file-icon.sel .label {
  background: #2f6fe0;
  color: #ffffff;
}

.desk .mini {
  width: 52px;
  height: 4px;
  border-radius: 999px;
  background: var(--chip);
  overflow: hidden;
}

.desk .mini > span,
.desk .pbar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.desk .mini.failed > span,
.desk .pbar.failed > span {
  background: var(--danger);
}

.desk .ttl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--chip);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.desk .ttl.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.desk .ttl.share {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.desk .share-badge {
  position: absolute;
  top: -7px;
  left: -9px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--card);
  color: var(--accent-ink);
  box-shadow:
    inset 0 0 0 1.5px var(--accent-ink),
    0 1px 2px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ───────────── a file's popup ───────────── */

.desk .pop {
  position: absolute;
  z-index: 20;
  width: 300px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--card);
  box-shadow:
    var(--shadow-pop),
    inset 0 0 0 1px var(--line);
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}

/* The popup's content; it scrolls when desk.js limits its height (the arrow stays outside). */
.desk .pop-in {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  padding: 16px;
  border-radius: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.desk .pop.wide {
  width: 620px;
}

.desk .pop.wide .pop-in {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  column-gap: 20px;
  align-items: start;
}

.desk .pop.wide.rows .pop-in {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.desk .pop-main,
.desk .pop-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.desk .pop::before {
  content: '';
  position: absolute;
  left: calc(var(--arrow, 150px) - 7px);
  top: -6px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--card);
  transform: rotate(45deg);
}

.desk .pop.above::before {
  top: auto;
  bottom: -6px;
}

/* Placed over its icon because neither side had room: no arrow. */
.desk .pop.loose::before {
  display: none;
}

.desk .pop-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-all;
}

.desk .facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 13px;
}

.desk .facts > div {
  display: contents;
}

.desk .pop.rows .pop-main .facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 16px;
}

.desk .pop.rows .pop-main .facts > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.desk .facts dt {
  color: var(--ink-2);
}

.desk .facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.desk .pop-note {
  margin: 0;
}

.desk .pop-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desk .pop-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.desk .pop-caption {
  color: var(--ink-2);
}

.desk .pbar {
  height: 6px;
  border-radius: 999px;
  background: var(--chip);
  overflow: hidden;
}

.desk .pop-actions {
  display: flex;
  gap: 8px;
}

.desk .pop-actions .pill {
  flex: 1 1 0;
  min-height: 40px;
  padding: 0 12px;
}

.desk .pill-wide {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  box-sizing: border-box;
}

/* A quiet button on the share box's tint. */
.desk .pill-card {
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}

.desk .share-revoke,
.desk .share-revoke:hover {
  background: var(--card);
  color: var(--danger-ink);
  box-shadow: inset 0 0 0 1px var(--danger-soft);
}

/* ───────────── share link (in a finished file's popup) ───────────── */

.desk .share-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.desk .share-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-ink);
}

.desk .share-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 0 12px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}

.desk .share-url {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desk .share-url strong {
  color: var(--ink);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.desk .share-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.desk .field-lbl {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.desk .field-lbl .meta {
  font-weight: 400;
}

.desk .seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: var(--chip);
}

.desk .seg button {
  height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.desk .seg button:hover {
  color: var(--ink);
}

.desk .seg button[aria-pressed='true'] {
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--line);
}

.desk .seg button:focus-visible {
  outline-offset: 1px;
}

.desk .pin-in {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink-3);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}

.desk .pin-in::placeholder {
  color: var(--ink-2);
  letter-spacing: 0;
  font-size: 13px;
}

.desk .pin-in:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.desk .pin-in.bad {
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.desk .help {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.desk .help.bad {
  color: var(--danger-ink);
}

/* An open form uses two option columns below the file's name and facts. */
.desk .pop.rows .share-box:has(> .f-head) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    'head note'
    'dur lim'
    'pin go';
  gap: 12px 16px;
  align-items: start;
}

.desk .pop.rows .share-box:has(> .f-mode) {
  grid-template-areas:
    'head head'
    'dur lim'
    'mode pin'
    'note go';
}

.desk .pop.rows .f-head {
  grid-area: head;
  align-self: baseline;
}

.desk .pop.rows .f-dur {
  grid-area: dur;
}

.desk .pop.rows .f-lim {
  grid-area: lim;
}

.desk .pop.rows .f-pin {
  grid-area: pin;
}

.desk .pop.rows .f-mode {
  grid-area: mode;
}

.desk .pop.rows .f-note {
  grid-area: note;
  align-self: baseline;
  text-align: right;
}

.desk .pop.rows .f-go {
  grid-area: go;
  align-self: end;
}

.desk .pop.rows .share-box:has(> .f-mode) > .f-note {
  text-align: left;
}

/* ───────────── bundles: files shared together, one stacked icon ───────────── */

.desk .seg.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.desk .seg button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.desk .stack-docs {
  position: relative;
  display: block;
  width: 62px;
  height: 70px;
}

.desk .stack-docs .doc {
  position: absolute;
  left: 0;
  top: 0;
}

.desk .stack-docs .d3 {
  left: 10px;
  top: 4px;
  transform: rotate(9deg);
}

.desk .stack-docs .d2 {
  left: 5px;
  top: 2px;
  transform: rotate(4.5deg);
}

.desk .count-badge {
  position: absolute;
  right: -12px;
  top: -9px;
  min-width: 24px;
  height: 24px;
  box-sizing: border-box;
  padding: 0 7px;
  border-radius: 999px;
  background: #2f6fe0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg);
}

.desk .bundle-icon {
  transition: opacity 0.2s ease;
}

/* Its files are still flying in. */
.desk .bundle-icon.arriving {
  opacity: 0;
}

/* Flying back to its place: the flying document stands in for it. */
.desk .file-icon.flying {
  visibility: hidden;
}

.desk .blist {
  display: flex;
  flex-direction: column;
  margin: 0 -4px;
  border-top: 1px solid var(--line);
}

.desk .blist-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.desk .blist-toggle:hover {
  background: var(--chip);
}

.desk .blist-toggle:focus-visible {
  outline-offset: 1px;
}

.desk .blist-toggle .chev {
  transition: transform 0.2s ease;
}

.desk .blist-toggle[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}

.desk .blist-items {
  list-style: none;
  margin: 0;
  padding: 0 8px;
}

.desk .blist-items li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  font-size: 12px;
}

.desk .bf-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.desk .bf-meta {
  flex: none;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* Documents on their way into a bundle, back home, or shrinking away (bundle-fly.js). */
.desk .fly {
  position: absolute;
  z-index: 18;
  width: 112px;
  display: flex;
  justify-content: center;
  padding-top: 10px;
  pointer-events: none;
  transition:
    left 0.4s cubic-bezier(0.3, 0.7, 0.2, 1),
    top 0.4s cubic-bezier(0.3, 0.7, 0.2, 1),
    opacity 0.4s ease,
    transform 0.4s ease;
}

.desk .fly .doc {
  box-shadow:
    inset 0 0 0 1px var(--line),
    var(--shadow-card);
}

@media (prefers-reduced-motion: reduce) {
  .desk .fly,
  .desk .bundle-icon,
  .desk .blist-toggle .chev {
    transition: none;
  }
}

/* ───────────── rubber band, drag ghost ───────────── */

.desk .marquee {
  position: absolute;
  z-index: 15;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-soft);
  pointer-events: none;
}

.desk .ghost {
  position: absolute;
  z-index: 25;
  pointer-events: none;
}

.desk .ghost .doc {
  position: absolute;
  left: 0;
  top: 0;
  box-shadow:
    inset 0 0 0 1px var(--line),
    var(--shadow-card);
}

.desk .ghost .ghost-back2 {
  left: 8px;
  top: 6px;
  transform: rotate(6deg);
}

.desk .ghost .ghost-back1 {
  left: 4px;
  top: 3px;
  transform: rotate(3deg);
}

.desk .ghost-count {
  position: absolute;
  left: 44px;
  top: -10px;
  min-width: 24px;
  height: 24px;
  box-sizing: border-box;
  padding: 0 7px;
  border-radius: 999px;
  background: #2f6fe0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

.desk .ghost-cap {
  position: absolute;
  left: -30px;
  top: 84px;
  width: 140px;
  text-align: center;
}

/* ───────────── bottom line: usage ring left, key guide in the middle ───────────── */

.desk .foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(128px, 1fr) minmax(0, auto) minmax(128px, 1fr);
  align-items: center;
  gap: 10px 24px;
  padding: 12px 24px 16px;
  pointer-events: none;
}

.desk .keys {
  grid-column: 2;
  display: flex;
  gap: 6px 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-2);
}

.desk .kbd {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  margin-right: 4px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}

.desk .usage {
  grid-column: 1;
  justify-self: start;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.desk .usage:hover {
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--ink-3);
}

.desk .usage[aria-expanded='true'] {
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 2px var(--accent);
}

.desk .usage svg {
  display: block;
  flex: none;
}

.desk .ring-track {
  stroke: var(--ring-track);
}

.desk .ring-fill {
  stroke: var(--accent);
}

.desk .usage-pct {
  font-weight: 700;
}

.desk .usage.low .ring-fill {
  stroke: var(--warn-ink);
}

.desk .usage.low .usage-pct {
  color: var(--warn-ink);
}

/* ───────────── usage popup (opens upward from the ring) ───────────── */

.desk .stats {
  position: absolute;
  left: 24px;
  z-index: 45;
  width: 360px;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--card);
  box-shadow:
    var(--shadow-pop),
    inset 0 0 0 1px var(--line);
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
  outline: none;
}

.desk .stats::before {
  content: '';
  position: absolute;
  left: 20px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--card);
  transform: rotate(45deg);
}

.desk .stats-in {
  position: relative;
  box-sizing: border-box;
  padding: 12px 16px 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.desk .stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -6px;
}

.desk .stats-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.desk .stats-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.desk .stats-sec.first {
  padding-top: 0;
  border-top: 0;
}

.desk .sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.desk .sec-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.desk .stack {
  display: flex;
  gap: 2px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}

.desk .stack > span {
  flex: 0 1 auto;
  height: 100%;
  min-width: 0;
}

.desk .seg-files {
  background: var(--seg-files);
}

.desk .seg-held {
  background: var(--seg-held);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.28) 0 3px,
    transparent 3px 7px
  );
}

.desk .seg-free {
  background: var(--seg-free);
}

.desk .legend {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  margin: 0;
  font-size: 12px;
}

.desk .legend dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
}

.desk .legend dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.desk .legend .total {
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  margin-top: 2px;
  color: var(--ink);
  font-weight: 700;
}

.desk .legend-sw {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.desk .warn-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: 12px;
}

.desk .hrow {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.desk .hlab {
  color: var(--ink-2);
}

.desk .hnum {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.desk .hbar {
  height: 8px;
  border-radius: 999px;
  background: var(--chip);
  overflow: hidden;
}

.desk .hbar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--seg-other);
}

.desk .hbar.up > span {
  background: var(--accent);
}

.desk .hbar.err > span {
  background: var(--danger);
}

.desk .speeds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.desk .speed {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 12px;
  color: var(--ink-2);
}

.desk .speed strong {
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.desk .hours-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

.desk .hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  grid-template-rows: 100%;
  column-gap: 2px;
  align-items: end;
  height: 56px;
}

.desk .hr {
  display: block;
  border-radius: 2px 2px 0 0;
  background: var(--bar-past);
}

.desk .hr.now {
  background: var(--accent);
}

.desk .hr.later {
  background: var(--chip);
}

.desk .hours-axis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  font-size: 11px;
  color: var(--ink-2);
}

/* Phones and narrow windows: buttons become icons, and the mouse and keyboard guide goes. */
@media (max-width: 640px) {
  .desk .desk-bar .lbl {
    display: none;
  }

  .desk .desk-bar .pill {
    width: 40px;
    padding: 0;
  }

  .desk .keys {
    display: none;
  }

  .desk .desk-bar {
    padding: 12px 12px 0 16px;
  }

  .desk .foot {
    padding: 10px 12px 12px;
  }

  .desk .stats {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

@media (pointer: coarse) {
  .desk .keys {
    display: none;
  }
}
