/* The interface's own look, on the shared design tokens: nawa-ui's (vendor/nawa-ui/tokens.css) with the product's
   values over them (tokens.css, the Ledger direction). Logical properties only, so that a right-to-left locale needs
   no other sheet. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--nw-font-family-text);
  font-size: 100%;
  line-height: var(--nw-line-height-body);
  color: var(--nw-color-text);
  background: var(--nw-color-page);
}

body {
  margin: 0;
  font-size: var(--nw-font-size-m);
  min-block-size: 100vh;
}

a {
  color: var(--nw-color-accent-text);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--nw-color-action-hover);
}

:focus-visible {
  outline: var(--nw-border-width-3) solid var(--nw-color-focus-ring);
  outline-offset: var(--nw-space-2);
  box-shadow: var(--nw-shadow-focus-edge);
}

h1 {
  font-size: var(--nw-font-size-xl);
  font-weight: var(--nw-font-weight-semibold);
  line-height: var(--nw-line-height-tight);
  color: var(--nw-color-text-strong);
  margin-block: var(--nw-space-12) var(--nw-space-16);
}

h1:focus {
  outline: none;
}

h1:focus-visible {
  outline: var(--nw-border-width-3) solid var(--nw-color-focus-ring);
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  inset-inline-start: var(--nw-space-8);
  inset-block-start: -100px;
  padding: var(--nw-space-8) var(--nw-space-12);
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-radius: var(--nw-radius-m);
  z-index: var(--nw-z-overlay);
}

.skip:focus {
  inset-block-start: var(--nw-space-8);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nw-space-16);
}

a.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.sheet {
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
}

.sheet.narrow {
  max-inline-size: 28rem;
  margin-inline: auto;
  margin-block-start: var(--nw-space-32);
  padding: var(--nw-space-24);
}

.sheet.scroll {
  overflow-x: auto;
}

.lead {
  color: var(--nw-color-text-muted);
  margin-block: 0 var(--nw-space-16);
}

.notice,
.alert {
  padding: var(--nw-space-8) var(--nw-space-12);
  border: var(--nw-border-width-1) solid;
  border-radius: var(--nw-radius-m);
  margin-block: 0 var(--nw-space-16);
}

.notice {
  color: var(--nw-color-status-progress-ink);
  background: var(--nw-color-status-progress-wash);
  border-color: var(--nw-color-status-progress-line);
}

.alert {
  color: var(--nw-color-status-danger-ink);
  background: var(--nw-color-status-danger-wash);
  border-color: var(--nw-color-status-danger-line);
}

.announce .notice {
  margin-block: var(--nw-space-16) 0;
}

/* Forms */
.form {
  display: grid;
  gap: var(--nw-space-16);
}

.field {
  display: grid;
  gap: var(--nw-space-4);
}

label {
  font-size: var(--nw-font-size-label);
  font-weight: var(--nw-font-weight-medium);
}

input[type="text"],
input[type="password"],
select {
  font: inherit;
  color: var(--nw-color-text);
  background: var(--nw-color-surface);
  min-block-size: var(--nw-size-control-m);
  padding-inline: var(--nw-space-12);
  border: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-radius: var(--nw-radius-m);
}

select {
  min-block-size: var(--nw-size-control-compact);
  padding-inline: var(--nw-space-8);
}

.button {
  font: inherit;
  font-weight: var(--nw-font-weight-medium);
  min-block-size: var(--nw-size-control-m);
  padding-inline: var(--nw-space-16);
  border-radius: var(--nw-radius-m);
  border: var(--nw-border-width-1) solid transparent;
  cursor: pointer;
}

.button.primary {
  color: var(--nw-color-action-text);
  background: var(--nw-color-action);
}

.button.primary:hover {
  background: var(--nw-color-action-hover);
}

.button.secondary {
  min-block-size: var(--nw-size-control-compact);
  color: var(--nw-color-accent-text);
  background: var(--nw-color-surface);
  border-color: var(--nw-color-border-strong);
}

.button.secondary:hover {
  background: var(--nw-color-surface-hover);
}

/* Where an item is, inside a list or a choice (the bin's, the folder picker's): a slash between steps reads the same in
   both directions. */
.trail ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nw-space-4);
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--nw-color-text-muted);
}

.trail li + li::before {
  content: "/" / "";
  margin-inline-end: var(--nw-space-4);
  color: var(--nw-color-border-strong);
}

.trail [aria-current="page"] {
  color: var(--nw-color-text);
}

/* The breadcrumb component's separator (packages/components/docs/breadcrumb.md). Its own sheet lays the line out and
   holds no string, so the chevron is drawn here, from two borders, and turned the other way when the page runs right
   to left. */
.breadcrumb li + li::before {
  content: "" / "";
  display: inline-block;
  inline-size: var(--nw-space-6);
  block-size: var(--nw-space-6);
  margin-inline-end: var(--nw-space-4);
  vertical-align: middle;
  border-block-start: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-inline-end: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  transform: rotate(45deg);
}

/* The folded steps are a list under their button, one a line: no separator between them. */
.breadcrumb details li + li::before {
  display: none;
}

.breadcrumb:dir(rtl) li + li::before {
  transform: rotate(-45deg);
}

/* A search's filters: the panel beside the results, the chips of those chosen above them. */
.filters {
  display: grid;
  gap: var(--nw-space-16);
  padding: var(--nw-space-16);
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
}

.filters fieldset {
  display: grid;
  gap: var(--nw-space-8);
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.filters legend {
  padding: 0;
  margin-block-end: var(--nw-space-8);
  font-weight: var(--nw-font-weight-semibold);
}

.filters label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nw-space-4) var(--nw-space-8);
  font-weight: var(--nw-font-weight-regular);
}

.filters .count {
  margin-inline-start: auto;
  color: var(--nw-color-text-muted);
  font-variant-numeric: tabular-nums;
}

.filters input[type="number"],
.filters input[type="date"],
.filters input[type="datetime-local"],
.filters input[type="text"] {
  inline-size: 100%;
  font: inherit;
  color: var(--nw-color-text);
  background: var(--nw-color-surface);
  min-block-size: var(--nw-size-control-m);
  padding-inline: var(--nw-space-8);
  border: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-radius: var(--nw-radius-m);
}

.filters p {
  margin: 0;
}

.filters .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nw-space-8) var(--nw-space-16);
}

/* The panel in a column of its own, as tall as the rows beside it; the last row takes what it leaves. */
.listing:has(> .filters) {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  grid-template-rows: repeat(5, auto) 1fr;
  column-gap: var(--nw-space-24);
  align-items: start;
}

.listing > .filters {
  grid-column: 1;
  grid-row: 1 / -1;
}

.listing:has(> .filters) > :not(.filters) {
  grid-column: 2;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nw-space-8);
  list-style: none;
  margin: 0 0 var(--nw-space-12);
  padding: 0;
}

.chips a {
  display: inline-flex;
  align-items: center;
  gap: var(--nw-space-8);
  min-block-size: var(--nw-size-control-compact);
  padding-inline: var(--nw-space-12);
  color: var(--nw-color-text);
  background: var(--nw-color-accent-tint);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
  text-decoration: none;
}

.chips a::after {
  content: "\00D7" / "";
}

.chips a:hover {
  border-color: var(--nw-color-border-strong);
}

/* The column chooser of the search results, between the chips and the table (CE-6). */
.results-columns {
  margin: 0 0 var(--nw-space-12);
}

@media (width < 48rem) {
  .listing:has(> .filters) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .listing > .filters,
  .listing:has(> .filters) > :not(.filters) {
    grid-column: 1;
    grid-row: auto;
  }

  .listing > .filters {
    margin-block-end: var(--nw-space-16);
  }
}

/* The about page (packages/components/docs/about.md): its three sections one under the other, each headed as the
   details' sections are; the product's facts as their list, the modules and the licences as the app's tables. On a
   phone a table wider than the page scrolls inside its section, words kept whole, and the page never scrolls
   sideways; the commit alone breaks anywhere. Before the app's tables (.entries), whose cells' rules are more
   specific. */
.about-product,
.about-modules,
.about-licences {
  margin-block-end: var(--nw-space-24);
}

.about-product h2,
.about-modules h2,
.about-licences h2 {
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-strong);
  margin-block: 0 var(--nw-space-12);
}

.about-product dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--nw-space-8) var(--nw-space-24);
  margin: 0;
}

.about-product dt {
  color: var(--nw-color-text-muted);
}

.about-product dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.about-modules,
.about-licences {
  overflow-x: auto;
}

.about-modules table,
.about-licences table {
  inline-size: 100%;
  border-collapse: collapse;
}

.about-modules th,
.about-modules td,
.about-licences th,
.about-licences td {
  text-align: start;
  vertical-align: top;
  padding-block: var(--nw-space-8);
  padding-inline: var(--nw-space-12);
  border-block-end: var(--nw-border-width-1) solid var(--nw-color-border-subtle);
  font-weight: inherit;
}

.about-modules thead,
.about-licences thead {
  font-size: var(--nw-font-size-label);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-muted);
}

.about-licences ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 560px) {
  .about-product dl {
    grid-template-columns: 1fr;
    gap: var(--nw-space-4);
  }

  .about-product dd {
    margin-block-end: var(--nw-space-8);
  }

  .about-modules th,
  .about-modules td,
  .about-licences th,
  .about-licences td {
    padding-inline: var(--nw-space-4);
  }
}

/* Tables: rules between rows, no card shadow; each cell in the middle of its row, so that a row's size and dates
   stand level with its name, beside the entry's icon (RF-19), and not on the icon's lower edge. */
.entries {
  inline-size: 100%;
  border-collapse: collapse;
}

.entries th,
.entries td {
  text-align: start;
  padding-block: var(--nw-space-8);
  padding-inline: var(--nw-space-12);
  border-block-end: var(--nw-border-width-1) solid var(--nw-color-border-subtle);
  vertical-align: middle;
}

.entries thead th {
  font-size: var(--nw-font-size-label);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-muted);
  border-block-end-color: var(--nw-color-border);
  white-space: nowrap;
}

.entries tbody th {
  font-weight: var(--nw-font-weight-medium);
}

/* In a document's side panel (its history): each version's name on one line ("Version 2 (current)"); when it was made
   wraps instead (below), and the cells sit closer, so that the table keeps to the panel's width, on a phone too. */
.viewer-side .entries th,
.viewer-side .entries td {
  padding-inline: var(--nw-space-8);
}

.viewer-side .entries tbody th {
  white-space: nowrap;
}

.entries tbody tr:hover {
  background: var(--nw-color-surface-hover);
}

.entries tbody tr:last-child th,
.entries tbody tr:last-child td {
  border-block-end: none;
}

.entries .number {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entries time {
  white-space: nowrap;
}

.viewer-side .entries time {
  white-space: normal;
}

.entries thead a {
  color: inherit;
  text-decoration: none;
}

.entries thead a:hover {
  text-decoration: underline;
}

.entries th[aria-sort] a {
  color: var(--nw-color-text-strong);
}

.entries th[aria-sort="ascending"] a::after {
  content: "\2191" / "";
  margin-inline-start: var(--nw-space-4);
}

.entries th[aria-sort="descending"] a::after {
  content: "\2193" / "";
  margin-inline-start: var(--nw-space-4);
}

.entries tr.folder th a {
  font-weight: var(--nw-font-weight-semibold);
}

.empty {
  padding: var(--nw-space-24);
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
  color: var(--nw-color-text-muted);
}

/* Pager */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--nw-space-12) var(--nw-space-24);
  margin-block-start: var(--nw-space-12);
}

.pager p {
  margin: 0;
  color: var(--nw-color-text-muted);
}

.pager ul {
  display: flex;
  align-items: center;
  gap: var(--nw-space-16);
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-size {
  display: flex;
  align-items: center;
  gap: var(--nw-space-8);
  margin: 0;
}

/* A document's page (packages/components/docs/viewer.md, the viewer's layout): its one bar, then its view and, at the
   end of the line, the side panel of its details and versions, the panel's width; under 48rem the side goes under the
   view. Layout only: the bar is the toolbar's, the tabs, the details and the history are their components'. */
.viewer-bar {
  margin-block-end: var(--nw-space-16);
}

.viewer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--nw-size-panel-width);
  gap: var(--nw-space-24);
  align-items: start;
}

@media (width < 48rem) {
  .viewer-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A document's view and details sheets, where a page still has them. */
.view,
.details {
  padding: var(--nw-space-16) var(--nw-space-24);
  margin-block-end: var(--nw-space-24);
}

.view h2,
.details h2 {
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-strong);
  margin-block: 0 var(--nw-space-12);
}

.view .frame,
.viewer-body .frame,
.compare-view .frame,
.compare-changes .frame {
  display: block;
  inline-size: 100%;
  block-size: 70vh;
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
  background: var(--nw-color-surface-sunken);
}

.view .picture,
.viewer-body .picture,
.compare-view .picture {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

/* A page shown in a frame of another page of this app (Framed, src/web/views/layout.tsx): the document viewer's. Its
   body fills the frame and its one child the body, so that the viewer's own frame, as high as its parent, fills it. */
.framed {
  block-size: 100vh;
}

.framed > * {
  block-size: 100%;
}

.framed img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  margin-inline: auto;
}

.framed p {
  margin: var(--nw-space-16);
}

.view .player,
.viewer-body .player,
.compare-view .player {
  display: block;
  inline-size: 100%;
  max-inline-size: 40rem;
}

.view video.player,
.viewer-body video.player,
.compare-view video.player {
  max-inline-size: 100%;
}

/* The comparison of two versions (packages/components/docs/version-compare.md): the form that chooses them, then the
   two versions side by side, the older first, which is the start of the line whichever way the page runs; one above
   the other on a narrow screen. Every side is logical. */
.compare-form,
.compare-side {
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
  padding: var(--nw-space-16) var(--nw-space-24);
  margin-block-end: var(--nw-space-24);
}

.compare-form {
  display: grid;
  gap: var(--nw-space-12);
  max-inline-size: 40rem;
}

.compare-form p {
  margin: 0;
}

.compare-form p:not(.actions) {
  display: grid;
  gap: var(--nw-space-4);
}

.compare-form select {
  inline-size: 100%;
  min-inline-size: 0;
}

.compare-form h2,
.compare-side h2 {
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-strong);
  margin-block: 0 var(--nw-space-12);
}

/* Each side is two rows of the pair's grid, what the version is and what it shows, so that the two views start at one
   height whatever the two descriptions hold. */
.compare-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: var(--nw-space-24);
}

.compare-sides .compare-side {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  min-inline-size: 0;
}

.compare-which {
  margin: 0;
  color: var(--nw-color-text-muted);
  font-size: var(--nw-font-size-label);
}

.compare-about {
  min-inline-size: 0;
}

.compare-side dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--nw-space-8) var(--nw-space-16);
  margin-block: 0 var(--nw-space-16);
}

.compare-side dt {
  color: var(--nw-color-text-muted);
}

.compare-side dd {
  margin: 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* Two versions whose changes the viewer marks: each side its label alone, and the marks in one frame below both, across
   the two columns, after what they do not say (the comparison's one body, `compare-marked`). */
.compare-view:empty {
  display: none;
}

.compare-marked {
  grid-column: 1 / -1;
  min-inline-size: 0;
}

.compare-changes {
  margin-block-end: var(--nw-space-24);
}

@media (width < 48rem) {
  .compare-sides {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .compare-sides .compare-side {
    grid-row: auto;
    grid-template-rows: auto auto;
  }
}

.details dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--nw-space-8) var(--nw-space-24);
  margin: 0;
}

.details dt {
  color: var(--nw-color-text-muted);
}

.details dd {
  margin: 0;
}

.details ul {
  margin: 0;
  padding-inline-start: var(--nw-space-20);
}

@media (max-width: 560px) {
  .details dl {
    grid-template-columns: 1fr;
    gap: var(--nw-space-4);
  }

  .details dd {
    margin-block-end: var(--nw-space-8);
  }
}

.muted,
.hint {
  color: var(--nw-color-text-muted);
}

.hint {
  margin-block: var(--nw-space-12) 0;
}

/* What describes an entry: its fields read, and the description form. A typed value takes the direction of each of
   its own lines (`dir="auto"` on the element, `unicode-bidi: plaintext` here), so that Arabic, Latin and mixed lines
   each read in their own order. */
.about {
  padding: var(--nw-space-16) var(--nw-space-24);
  margin-block-end: var(--nw-space-24);
}

.about h2 {
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-strong);
  margin-block: 0 var(--nw-space-12);
}

.field-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--nw-space-8) var(--nw-space-24);
  margin: 0 0 var(--nw-space-16);
}

.field-list dt {
  color: var(--nw-color-text-muted);
}

.field-list dd {
  margin: 0;
}

.field-list ul {
  margin: 0;
  padding-inline-start: var(--nw-space-20);
}

.value,
.fields-form input[dir="auto"],
.fields-form textarea {
  unicode-bidi: plaintext;
}

.lines {
  white-space: pre-line;
}

.unset {
  color: var(--nw-color-text-muted);
  font-style: italic;
}

.fields-form {
  max-inline-size: 40rem;
}

.fields-form input[type="date"],
.fields-form input[type="datetime-local"],
.fields-form textarea {
  font: inherit;
  color: var(--nw-color-text);
  background: var(--nw-color-surface);
  min-block-size: var(--nw-size-control-m);
  padding-block: var(--nw-space-4);
  padding-inline: var(--nw-space-12);
  border: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-radius: var(--nw-radius-m);
}

.fields-form textarea {
  resize: vertical;
}

.fields-form .hint {
  margin: 0;
  font-size: var(--nw-font-size-label);
  color: var(--nw-color-text-muted);
}

.fields-form .problem {
  margin: 0;
  font-weight: var(--nw-font-weight-medium);
  color: var(--nw-color-status-danger-ink);
}

.fields-form .invalid input,
.fields-form .invalid select,
.fields-form .invalid textarea {
  border-color: var(--nw-color-status-danger-line);
  border-width: var(--nw-border-width-3);
}

.fields-form .fixed .label {
  font-size: var(--nw-font-size-label);
  font-weight: var(--nw-font-weight-medium);
}

.fields-form .required {
  font-weight: var(--nw-font-weight-regular);
  color: var(--nw-color-text-muted);
}

/* A group of the description's fields (packages/components/docs/field-editor.md): its fields as far apart as the
   form's own. */
.fields-form .field-group {
  display: grid;
  gap: var(--nw-space-16);
}

.alert ul {
  margin: var(--nw-space-4) 0 0;
  padding-inline-start: var(--nw-space-20);
}

.alert p {
  margin: 0;
}

@media (max-width: 560px) {
  .field-list {
    grid-template-columns: 1fr;
    gap: var(--nw-space-4);
  }

  .field-list dd {
    margin-block-end: var(--nw-space-8);
  }
}

/* Search: the box in the masthead, between the product's mark and the account. */
.search {
  display: block;
}

.search form {
  display: flex;
  align-items: center;
  gap: var(--nw-space-8);
  margin: 0;
}

.search input[type="search"] {
  flex: 1 1 auto;
  min-inline-size: 0;
  font: inherit;
  color: var(--nw-color-text);
  background: var(--nw-color-surface);
  min-block-size: var(--nw-size-control-compact);
  padding-inline: var(--nw-space-12);
  border: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  border-radius: var(--nw-radius-m);
}

.entries .trail ol {
  font-size: var(--nw-font-size-label);
}

/* Who has access: the table of grants, the forms beside each, the people and groups found, the review of a change.
   A name takes its own direction (`bdi`, `dir="auto"`); the rest follows the page's. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--nw-space-8) var(--nw-space-12);
  margin-block: 0 var(--nw-space-12);
}

.access-list td .actions {
  gap: var(--nw-space-8);
}

.access-list td .inline-form {
  margin: 0;
  align-items: center;
}

.access-list,
.found {
  margin-block-end: var(--nw-space-16);
}

.found {
  list-style: none;
  padding: 0;
}

.found .holder,
.everyone .holder {
  min-inline-size: 12rem;
}

.detail,
.muted {
  color: var(--nw-color-text-muted);
}

.muted {
  font-size: var(--nw-font-size-label);
}

.refusal {
  font-weight: var(--nw-font-weight-medium);
  color: var(--nw-color-status-danger-ink);
}

.apply .sure {
  display: flex;
  align-items: start;
  gap: var(--nw-space-8);
  margin-block-start: var(--nw-space-8);
}

.apply .sure input {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  margin: 0;
}

/* The bin (packages/components/src/bin/bin.tsx): a quiet button for what cannot be undone, and each row's actions. */
.button.danger {
  color: var(--nw-color-danger-action-text);
  background: var(--nw-color-surface);
  border-color: var(--nw-color-danger-action-line);
}

.button.danger:hover {
  background: var(--nw-color-surface-hover);
}

form.inline {
  display: inline;
  margin: 0;
}

/* Positioned, so that the hidden names of its actions stay inside the table's scrolling sheet on a narrow screen. */
.row-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nw-space-12);
}

/* The choice of a folder to move or copy into: its trail apart from the way to do it, so that both are told apart. */
.details .trail {
  margin-block-end: var(--nw-space-12);
}

.outcome {
  margin-block: var(--nw-space-16) var(--nw-space-8);
}

.outcome .state {
  font-weight: var(--nw-font-weight-medium);
}

.outcome.refused .state {
  color: var(--nw-color-status-danger-ink);
}

.outcome.unconfirmed .state {
  color: var(--nw-color-status-attention-ink);
}

/* The frame (src/web/views/layout.tsx, which places the shell and the user menu: packages/components/docs/shell.md and
   user-menu.md; the Ledger direction's layout.css and the blocks of FW-02's components.css it needs). The components
   write the classes, this sheet is the product's look of them. The masthead across the top, ruled off in ink; the
   spaces' side menu at the start; the page; the docked side panel's place at the end, whose column takes no room
   while a page has no panel. Under 48rem, the width this app gives (the shell does not know it), the side menu
   becomes a sheet over the page, opened by the masthead's toggle (a popover: no script needed to open or close it).
   Every side is logical, so that a right-to-left page mirrors the frame. */
.shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "masthead masthead masthead"
    "side content end";
  min-block-size: 100dvb;
}

/* The masthead: the title, the search box, the person and their user menu. */
.shell-header {
  grid-area: masthead;
  display: flex;
  align-items: center;
  gap: var(--nw-space-12);
  min-block-size: 3rem;
  padding-block: var(--nw-space-8);
  padding-inline: var(--nw-space-20);
  background: var(--nw-color-page);
  color: var(--nw-color-text-strong);
  border-block-end: var(--nw-border-width-3) solid var(--nw-color-text-strong);
}

.shell-title {
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  white-space: nowrap;
}

.shell-logo {
  block-size: var(--nw-size-control-m);
  inline-size: auto;
  flex: none;
}

.shell-header .search {
  flex: 0 1 26rem;
  min-inline-size: 0;
}

.shell-toggle:hover {
  background: var(--nw-color-rail-hover);
}

/* The user menu: the person, then the menu that holds the way out, at the end of the masthead. */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--nw-space-8);
  margin-inline-start: auto;
  font-size: var(--nw-font-size-s);
}

/* The language menu (RF-17): at the end of the masthead, just before the user menu when there is one. */
.language-menu {
  margin-inline-start: auto;
  font-size: var(--nw-font-size-s);
}

.language-menu + .user-menu {
  margin-inline-start: 0;
}

.language-menu [aria-current="true"] {
  font-weight: var(--nw-font-weight-semibold);
}

/* While a translation waits for its review (D-038), a line above every page of it. */
.review-note {
  margin: 0;
  padding-block: var(--nw-space-4);
  padding-inline: var(--nw-space-20);
  font-size: var(--nw-font-size-s);
  color: var(--nw-color-text-muted);
  border-block-end: var(--nw-border-width-1) solid var(--nw-color-border);
}

/* An icon is a file of icons/ painted in the text colour, the colour forced colours choose included. */
.icon,
.shell-toggle-icon {
  display: inline-block;
  inline-size: var(--nw-size-icon-m);
  block-size: var(--nw-size-icon-m);
  flex: none;
  background: currentColor;
  mask: no-repeat center / contain;
  forced-color-adjust: none;
}

.shell-toggle-icon {
  mask-image: url("icons/menu.svg");
}

.icon-spaces {
  mask-image: url("icons/spaces.svg");
}

.icon-bin {
  mask-image: url("icons/bin.svg");
}

/* The toggle: on a wide page it folds the docked side menu, which only the script can do, so it shows once the script
   has run (it marks the shell); on a phone it opens the sheet, which needs none. */
.shell-toggle {
  display: none;
  place-items: center;
  inline-size: var(--nw-size-control-m);
  block-size: var(--nw-size-control-m);
  padding: 0;
  color: inherit;
  background: transparent;
  border: var(--nw-border-width-1) solid transparent;
  border-radius: var(--nw-radius-m);
  cursor: pointer;
}

.shell[data-script] .shell-toggle {
  display: inline-grid;
}

/* The side menu. On a wide screen its popover is shown as part of the page, until the person folds it. */
.shell-side[popover] {
  grid-area: side;
  display: block;
  position: static;
  inset: auto;
  inline-size: var(--nw-size-rail-width);
  block-size: auto;
  margin: 0;
  padding-block: var(--nw-space-8);
  padding-inline: 0;
  color: var(--nw-color-rail-text);
  background: var(--nw-color-rail);
  border: 0;
  border-inline-end: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  font-size: var(--nw-font-size-s);
  overflow: auto;
}

.shell[data-side="folded"] .shell-side[popover]:not(:popover-open) {
  display: none;
}

/* Open, the side menu is a sheet over the page, above it (a popover is in the browser's top layer, out of the grid).
   It opens only on a phone, from the toggle; a screen that grows past the phone's width while it is open (a turn, a
   wider window) has app.js close it, and the side menu is docked in its column again. Without a script it stays this
   sheet, at any width, until the person closes it: a click outside it, Escape or one of its links. */
.shell-side[popover]:popover-open {
  position: fixed;
  inset-block: 0;
  inset-inline: 0 auto;
  inline-size: min(18rem, 85vi);
  block-size: 100dvb;
  box-shadow: var(--nw-shadow-dialog);
}

.shell-side[popover]::backdrop {
  background: var(--nw-color-scrim);
}

.shell-side-heading {
  margin: 0;
  padding-block: var(--nw-space-12) var(--nw-space-4);
  padding-inline: var(--nw-space-12);
  font-size: var(--nw-font-size-xs);
  font-weight: var(--nw-font-weight-semibold);
  line-height: var(--nw-line-height-tight);
  color: var(--nw-color-rail-text-muted);
}

.shell-side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shell-side .place {
  display: flex;
  align-items: center;
  gap: var(--nw-space-8);
  min-block-size: var(--nw-size-control-m);
  padding-inline: var(--nw-space-12);
  color: inherit;
  text-decoration: none;
  border-inline-start: var(--nw-border-width-3) solid transparent;
}

.shell-side .place:hover {
  background: var(--nw-color-rail-hover);
}

.shell-side .place:focus-visible {
  outline-color: var(--nw-color-rail-focus);
  outline-offset: calc(-1 * var(--nw-border-width-3));
}

.shell-side .place[aria-current] {
  color: var(--nw-color-text-strong);
  background: var(--nw-color-surface);
  border-inline-start-color: var(--nw-color-rail-mark);
  font-weight: var(--nw-font-weight-semibold);
}

/* The folder tree under the spaces (packages/components/docs/folder-tree.md): its own sheet sets each level in; here its
   names take the rail's look, and its toggle is drawn, an arrow from two borders that points down once its folder is
   open, and the other way when the page runs right to left. */
.shell-side .folder-tree {
  padding-block: var(--nw-space-8);
  padding-inline: var(--nw-space-8);
  border-block-start: var(--nw-border-width-1) solid var(--nw-color-border);
}

.shell-side .folder-tree-item,
.shell-side .folder-tree-more-link {
  color: inherit;
  text-decoration: none;
  border-radius: var(--nw-radius-s);
}

.shell-side .folder-tree-item:hover,
.shell-side .folder-tree-more-link:hover {
  background: var(--nw-color-rail-hover);
}

.shell-side .folder-tree-item:focus-visible,
.shell-side .folder-tree-more-link:focus-visible {
  outline-color: var(--nw-color-rail-focus);
}

.shell-side .folder-tree-item[aria-current] {
  color: var(--nw-color-text-strong);
  background: var(--nw-color-surface);
}

.shell-side .folder-tree-more-link {
  color: var(--nw-color-rail-text-muted);
}

.folder-tree-toggle {
  vertical-align: middle;
}

.folder-tree-toggle::before {
  content: "" / "";
  display: block;
  inline-size: var(--nw-space-6);
  block-size: var(--nw-space-6);
  margin-block: calc((var(--nw-size-icon-s) - var(--nw-space-6)) / 2);
  margin-inline: auto;
  border-block-start: var(--nw-border-width-1) solid currentColor;
  border-inline-end: var(--nw-border-width-1) solid currentColor;
  transform: rotate(45deg);
}

.folder-tree-toggle:dir(rtl)::before {
  transform: rotate(-45deg);
}

.folder-tree-node:has(> .folder-tree-group:not([hidden])) > .folder-tree-toggle::before {
  transform: rotate(135deg);
}

.folder-tree-node:has(> .folder-tree-group:not([hidden])) > .folder-tree-toggle:dir(rtl)::before {
  transform: rotate(-135deg);
}

/* The page: the announcement region (empty, it takes no room), then the main region. */
.shell-content {
  grid-area: content;
  min-inline-size: 0;
}

main {
  padding-block: var(--nw-space-12) var(--nw-space-24);
  padding-inline: var(--nw-space-20);
}

main:focus {
  outline: none;
}

.announce {
  padding-inline: var(--nw-space-20);
}

/* The docked side panel's place, for the page that has one; without one, it takes no room. */
.panel {
  grid-area: end;
  inline-size: var(--nw-size-panel-width);
  border-inline-start: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  overflow: auto;
}

.panel:empty {
  display: none;
}

@media (width < 48rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "masthead"
      "content"
      "end";
  }

  .shell-header {
    flex-wrap: wrap;
    padding-inline: var(--nw-space-12);
  }

  .shell-header .search {
    order: 3;
    flex-basis: 100%;
  }

  .user-menu-who {
    display: none;
  }

  .shell-toggle {
    display: inline-grid;
  }

  /* A sheet, closed or open: out of the page's flow, which is how the shell's script tells it from a docked one. */
  .shell-side[popover] {
    position: fixed;
  }

  .shell-side[popover]:not(:popover-open) {
    display: none;
  }

  main,
  .announce,
  .review-note {
    padding-inline: var(--nw-space-12);
  }

  .panel {
    inline-size: auto;
    border-inline-start: 0;
    border-block-start: var(--nw-border-width-1) solid var(--nw-color-border-strong);
  }
}

/* The picker of the upload area in a toolbar: its choice of a type and its button side by side. */
.toolbar .upload-button form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: end;
}

/* A document's page (RF-21): its name and what it is, then on the same line (or under it, when the line is too short)
   the page's one bar; the view and the side panel then fill the window's height, the side scrolling on its own. */
.document-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--nw-space-8) var(--nw-space-24);
  margin-block: 0 var(--nw-space-16);
}

.document-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.document-head .meta {
  margin: var(--nw-space-2) 0 0;
  color: var(--nw-color-text-muted);
  font-size: var(--nw-font-size-s);
}

.document-head .toolbar {
  margin: 0;
}

.document-head .toolbar > ul > li > a.primary {
  color: var(--nw-color-action-text);
  background: var(--nw-color-action);
  border-color: var(--nw-color-action);
}

.document-head .toolbar > ul > li > a.primary:hover {
  background: var(--nw-color-action-hover);
}

.viewer-main {
  --document-height: max(26rem, calc(100dvh - 13rem));
}

.viewer-body {
  position: relative;
}

.viewer-body .frame {
  block-size: var(--document-height);
}

/* With the script, one tab shown at a time, the side scrolls within the height of the view; without it, its panels are
   all shown, one under another, and the page scrolls. */
.viewer-side:has(.tabs[data-script]) {
  max-block-size: var(--document-height);
  overflow-y: auto;
}

.viewer-side {
  background: var(--nw-color-surface);
  border: var(--nw-border-width-1) solid var(--nw-color-border);
  border-radius: var(--nw-radius-m);
}

.viewer-side .tabs-list {
  padding-inline: var(--nw-space-12);
}

/* Who has access, when its tab is the one shown, or without the script, where every panel is: a wider side panel, so
   that the table keeps its columns, what each holder may do on one line. */
.viewer-main:has(.tabs[data-script] .tabs-panel:not([hidden]) .access-tab),
.viewer-main:has(.tabs:not([data-script]) .access-tab) {
  grid-template-columns: minmax(0, 1fr) min(42rem, 55%);
}

@media (width < 48rem) {
  .viewer-main,
  .viewer-main:has(.tabs[data-script] .tabs-panel:not([hidden]) .access-tab),
  .viewer-main:has(.tabs:not([data-script]) .access-tab) {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer-body .frame {
    block-size: 70vh;
  }

  .viewer-side:has(.tabs[data-script]) {
    max-block-size: none;
  }
}

/* Who has access, in its tab: what each holder may do on one line, in any language (review RF-21); the other columns
   wrap. A table still wider than the panel scrolls in its own place, never past the panel's edge. */
.access-tab .access-list {
  overflow-x: auto;
}

.access-tab .access-list thead th:nth-child(2),
.access-tab .access-list tbody td:first-of-type {
  white-space: nowrap;
}

/* A part of a tab of the side panel: a heading, then what it holds; a rule between one part and the next. The
   components' own regions in it lose the padding they have alone. */
.side-section {
  margin: 0;
  padding: var(--nw-space-12) var(--nw-space-16);
  border-block-end: var(--nw-border-width-1) solid var(--nw-color-border-subtle);
}

.side-section:last-child {
  border-block-end: none;
}

.side-section h2,
.side-section .details-panel h2 {
  margin: 0 0 var(--nw-space-8);
  font-size: var(--nw-font-size-title);
  font-weight: var(--nw-font-weight-semibold);
  color: var(--nw-color-text-strong);
}

.side-section .details-panel {
  padding: 0;
}

.side-section > p.actions,
.access-tab > p.actions {
  margin: var(--nw-space-8) 0 0;
}

/* The details: each fact its label at the start of its line, its value after it, in the description and the file's. */
.side-section dl.fields,
.side-section .details-panel dl {
  display: grid;
  gap: var(--nw-space-8);
  margin: 0;
}

.side-section dl.fields > .field,
.side-section .details-panel dl > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--nw-space-8);
}

.side-section dl.fields dt {
  color: var(--nw-color-text-muted);
  font-size: var(--nw-font-size-label);
}

.side-section dl.fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.side-section .field-group {
  margin-block-start: var(--nw-space-12);
}

.side-section .field-group > .legend {
  margin: 0 0 var(--nw-space-8);
  font-weight: var(--nw-font-weight-medium);
}

/* The description read: its Edit at the end of the heading's line. Edited, its form takes the part's width. */
.side-section.described {
  position: relative;
}

.side-section.described .field-view > .actions {
  position: absolute;
  inset-block-start: var(--nw-space-8);
  inset-inline-end: var(--nw-space-16);
  margin: 0;
}

.side-section.described .field-view > .notice {
  margin-block: 0 var(--nw-space-8);
}

.side-section.described form input:not([type="checkbox"], [type="radio"]),
.side-section.described form textarea,
.side-section.described form select {
  inline-size: 100%;
  box-sizing: border-box;
}

/* A new version: the numbers, then the form that asks before it sends (the upload area's), and what became of it. */
.side-section .said {
  margin: 0 0 var(--nw-space-8);
  padding: var(--nw-space-8) var(--nw-space-12);
  color: var(--nw-color-status-ok-ink);
  background: var(--nw-color-status-ok-wash);
  border-inline-start: var(--nw-space-4) solid var(--nw-color-status-ok-line);
}

.side-section .numbers {
  margin: 0 0 var(--nw-space-12);
  padding: var(--nw-space-8) var(--nw-space-12);
  color: var(--nw-color-status-progress-ink);
  background: var(--nw-color-status-progress-wash);
  border-inline-start: var(--nw-space-4) solid var(--nw-color-status-progress-line);
}

.send-version .upload-area form {
  align-items: stretch;
}

/* Dashed, the place a file may be dropped on; its other buttons than Send, the app's secondary ones. */
.send-version .upload-area .drop {
  border-style: dashed;
}

.send-version .upload-area [data-upload-pick],
.send-version .upload-area [data-upload-unchoose] {
  min-block-size: var(--nw-size-control-compact);
  color: var(--nw-color-accent-text);
  background: var(--nw-color-surface);
  border-color: var(--nw-color-border-strong);
}

.send-version .upload-area [data-upload-pick]:hover,
.send-version .upload-area [data-upload-unchoose]:hover {
  background: var(--nw-color-surface-hover);
}

.send-version .upload-area .comment input {
  inline-size: 100%;
  box-sizing: border-box;
}

/* While a file is dragged over the page (the upload area's mark on the root), the view is covered by what says where it
   goes: the drop lands on it rather than in the frame, which would keep it. */
.drop-over {
  display: none;
}

html[data-upload-dragging] .drop-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--nw-space-24);
  text-align: center;
  color: var(--nw-color-accent-text);
  background: var(--nw-color-action-tint);
  border: var(--nw-space-4) dashed var(--nw-color-accent);
  border-radius: var(--nw-radius-m);
  font-size: var(--nw-font-size-l);
  font-weight: var(--nw-font-weight-semibold);
  opacity: 0.94;
}

html[data-upload-dragging] .drop-over > span {
  padding: var(--nw-space-12) var(--nw-space-20);
  background: var(--nw-color-surface);
  border-radius: var(--nw-radius-m);
  box-shadow: var(--nw-shadow-overlay);
}

/* The latest versions, in the side panel's width: each version on two lines, its name and what it offers first, then
   when it was made and by whom. The table stays a table for a screen reader; only its rows are laid out. */
.viewer-side #side-versions thead th {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.viewer-side #side-versions tbody tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: var(--nw-space-2) var(--nw-space-12);
  padding: var(--nw-space-8) var(--nw-space-4);
  border-block-end: var(--nw-border-width-1) solid var(--nw-color-border-subtle);
}

.viewer-side #side-versions tbody tr:last-child {
  border-block-end: none;
}

.viewer-side #side-versions tbody th,
.viewer-side #side-versions tbody td {
  padding: 0;
  border: none;
}

.viewer-side #side-versions tbody th {
  grid-column: 1;
  grid-row: 1;
  white-space: normal;
}

.viewer-side #side-versions tbody td:first-of-type {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--nw-color-text-muted);
  font-size: var(--nw-font-size-s);
}

.viewer-side #side-versions tbody td .actions {
  margin: 0;
}

/* Who has access, in its tab: what is folded, its name a link's colour. */
.access-tab details {
  margin-block: var(--nw-space-12) 0;
}

.access-tab details > summary {
  cursor: pointer;
  font-weight: var(--nw-font-weight-medium);
  color: var(--nw-color-accent-text);
}

.access-tab details[open] > summary {
  margin-block-end: var(--nw-space-8);
}

.access-tab .lead {
  margin-block: 0 var(--nw-space-8);
  font-size: var(--nw-font-size-s);
}
