/* PLATOMUS: /quantum, sealed notes under RFC 10024, and the reader key marker
   on clan profiles. Prefix .qm- (the page) and .pq- (the profile marker).
   Built on the panel / btn / notice / cl-input vocabulary of app.css and
   clans.css, with the same phone rules: nothing wider than the screen, every
   text column min-width:0, and 44px tap targets from 720px down. */

.qm-page [hidden] {
  display: none !important;
}

.qm-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.qm-rfc {
  color: var(--accent);
  border-color: var(--accent-line);
}
.qm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
  min-width: 0;
}
.qm-main,
.qm-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.qm-aside {
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
}

.qm-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.qm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qm-row .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qm-row--quiet {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.qm-measure {
  max-width: 68ch;
}

.qm-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
}
.qm-state.is-open {
  color: var(--accent);
}

/* ------------------------------------------------------------ key panel */

.qm-kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  margin: 0;
}
.qm-kv dt {
  font-size: 9px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 2px;
}
.qm-kv dd {
  margin: 0;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}
.qm-fp {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.qm-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-2);
}
.qm-line svg {
  color: var(--ink-3);
  flex: 0 0 auto;
}
.qm-line .btn {
  margin-left: auto;
}
.qm-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn.qm-danger {
  color: var(--neg);
}
.btn.qm-danger:hover:not(:disabled) {
  border-color: var(--neg);
  color: var(--neg);
}

.qm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.qm-field > span {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.qm-codein {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
  text-transform: uppercase;
}
.qm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.qm-check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.qm-notice {
  align-items: flex-start;
  line-height: 1.5;
}
.qm-notice svg {
  flex: 0 0 auto;
  margin-top: 3px;
}
.qm-notice b {
  color: var(--ink-bright);
}
/* The recovery code: big enough to copy by hand, grouped by four. */
.qm-code {
  font-family: var(--f-mono);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--ink-bright);
  padding: 14px 16px;
  background: var(--wash);
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
  user-select: all;
}
.qm-err {
  font-size: 12.5px;
  color: var(--neg);
  min-height: 0;
}
.qm-err:empty {
  display: none;
}

/* ------------------------------------------------------------- seal form */

.qm-textarea {
  min-height: 110px;
}
.qm-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.qm-hint[data-state='live'] {
  color: var(--ink);
}
.qm-hint[data-state='live'] svg {
  color: var(--accent);
  vertical-align: -1px;
}
.qm-hint[data-state='bad'],
.qm-hint[data-state='error'],
.qm-hint[data-state='none'] {
  color: var(--warn);
}
.qm-compose-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.qm-compose-row .cl-count {
  margin-left: 0;
}
.qm-send {
  min-height: 44px;
  align-self: flex-start;
  min-width: 180px;
}

/* ----------------------------------------------------------------- inbox */

.qm-reload {
  margin-left: auto;
}
.qm-inbox-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--accent-tint);
  border-bottom: 1px solid var(--line);
}
.qm-inbox-note svg {
  color: var(--accent);
  flex: 0 0 auto;
}
.qm-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.qm-note:last-child {
  border-bottom: 0;
}
.qm-note-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  min-width: 0;
}
.qm-from {
  color: var(--ink-2);
}
.qm-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-bright);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.qm-text--locked {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.qm-text--closed {
  font-size: 12.5px;
  color: var(--warn);
}
.qm-empty {
  padding: 2rem 1.25rem;
}

/* ------------------------------------------------------------ where we stand */

.qm-fact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.qm-fact h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
}
.qm-fact p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.qm-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--ink-3);
  flex: 0 0 auto;
}
.qm-dot.is-good {
  background: var(--pos);
}
.qm-dot.is-warn {
  background: var(--warn);
}
/* Each flag stays whole with its value, so a wrap never strands a dash. */
.qm-cmd > span {
  white-space: nowrap;
}
.qm-cmd {
  display: block;
  font-family: var(--f-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  padding: 9px 11px;
  background: var(--wash);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
  user-select: all;
}

.qm-sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --------------------------------------------- reader key marker on profiles */

.pq-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.pq-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  border-color: var(--accent-line);
}
.pq-seal {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 0;
}
.pq-seal:hover {
  color: var(--accent-bright);
}
/* The /chats header link to sealed notes. */
.ch-sealed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-left: auto;
}
.pq-fine svg {
  color: var(--accent);
  vertical-align: -1px;
}

/* ------------------------------------------------------------- key exposure */
/* Three states, three quiet colours. Hidden is blue, not green: it means not on
   this chain yet, never safe. */

.qm-x {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  white-space: nowrap;
  vertical-align: 1px;
}
.qm-x--exposed {
  color: var(--warn);
  border-color: rgba(245, 196, 81, 0.35);
  background: rgba(245, 196, 81, 0.07);
}
.qm-x--hidden {
  color: var(--royal-ink);
  border-color: rgba(143, 180, 221, 0.35);
  background: rgba(143, 180, 221, 0.07);
}
.qm-x--contract {
  color: var(--ink-2);
}

.qm-expo-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  scroll-margin-top: calc(var(--topbar-h, 56px) + 14px);
}
.qm-expo-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.qm-h2 {
  font-family: var(--f-display);
  font-size: var(--fs-h2);
  font-weight: 600;
  color: var(--ink-bright);
  line-height: 1.15;
}
.qm-expo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}
.qm-when {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.qm-hint--bad {
  color: var(--warn);
}
.qm-check-out:empty {
  display: none;
}
.qm-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--wash);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  min-width: 0;
}
.qm-check-out[data-state='exposed'] .qm-result {
  border-color: rgba(245, 196, 81, 0.3);
}
.qm-check-out[data-state='hidden'] .qm-result {
  border-color: rgba(143, 180, 221, 0.3);
}
.qm-result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.qm-result-head .qm-x {
  font-size: 10px;
  padding: 1px 8px;
}
.qm-result-head .qm-link {
  margin-left: auto;
}
/* The display face draws 0 like O; an address reads in mono. */
.qm-result-head .pf-addr {
  font-family: var(--f-mono);
  font-size: 13px;
}
.qm-result-p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.qm-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.qm-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  padding: 10px 11px;
  background: var(--wash);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  min-width: 0;
}
.qm-tile span {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.qm-tile b {
  font-family: var(--f-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-bright);
  font-variant-numeric: tabular-nums;
}
.qm-board-scope {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.qm-board-scope h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.qm-bar {
  display: flex;
  height: 10px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--raised-2);
  border: 1px solid var(--line-2);
}
.qm-bar-seg {
  height: 100%;
  min-width: 2px;
}
.qm-bar-seg--exposed {
  background: var(--warn);
}
.qm-bar-seg--hidden {
  background: var(--royal-ink);
}
.qm-bar-seg--contract {
  background: var(--ink-3);
}
.qm-bar-seg--unknown {
  background: var(--line-3);
}
.qm-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.qm-leg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.qm-leg b {
  font-family: var(--f-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-bright);
  font-variant-numeric: tabular-nums;
}
.qm-leg-sub {
  font-size: 11.5px;
  color: var(--ink-3);
}
.qm-board-toggle {
  align-self: flex-start;
}
.qm-board-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.qm-board-table td,
.qm-board-table th {
  white-space: nowrap;
}

/* The exposure word beside each seat on a clan profile. */
.pq-x {
  margin-left: 2px;
}
.pq-memo {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ------------------------------------------------------- the sealed clan memo */

.mm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.mm-h {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.mm-ul {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  max-height: 260px;
  overflow: auto;
}
.mm-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  font-size: 12.5px;
}
.mm-row:last-child {
  border-bottom: 0;
}
.mm-row.is-skip {
  color: var(--ink-3);
}
.mm-seat {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  min-width: 18px;
}
.mm-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 6px;
  margin-left: auto;
  text-align: right;
  min-width: 0;
}
.mm-why,
.mm-note {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.mm-note {
  flex-basis: 100%;
}
.mm-st {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.mm-st--sent {
  color: var(--pos);
}
.mm-st--failed,
.mm-st--stopped {
  color: var(--warn);
}
.mm-st--sealing,
.mm-st--wallet,
.mm-st--pending {
  color: var(--accent);
}
.mm-v {
  color: var(--ink-3);
}
.mm-progress {
  font-size: 13px;
  color: var(--ink);
}
.mm-progress:empty {
  display: none;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1023px) {
  .qm-grid,
  .qm-expo {
    grid-template-columns: minmax(0, 1fr);
  }
  .qm-aside {
    position: static;
  }
}

@media (max-width: 720px) {
  .qm-row .btn,
  .qm-line .btn {
    min-height: 44px;
  }
  .qm-row .btn.pf-mini {
    min-height: 40px;
  }
  .qm-send {
    width: 100%;
    align-self: stretch;
  }
  .qm-code {
    font-size: 13.5px;
    padding: 12px;
  }
  .qm-kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .qm-kv dd {
    margin-bottom: 8px;
  }
  .qm-tiles {
    gap: 6px;
  }
  .qm-tile {
    padding: 8px 9px;
  }
  .qm-tile b,
  .qm-leg b {
    font-size: 15px;
  }
  .qm-board-wrap {
    max-height: 360px;
  }
  .qm-result-head .qm-link {
    margin-left: 0;
    min-height: 32px;
  }
  /* The board's read time is what gets quoted: on a phone it takes its own
     line under the title rather than being cut short. */
  .qm-board-head {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .qm-board-head .qm-when {
    flex-basis: 100%;
    white-space: normal;
  }
  .mm-row {
    flex-wrap: wrap;
  }
  .mm-right {
    justify-content: flex-start;
    text-align: left;
    margin-left: 26px;
    flex-basis: 100%;
  }
  .pq-seal {
    padding: 8px 0;
  }
  /* On a phone the marker sits under the address, so the members table
     keeps its address column narrow and Joined stays in view. */
  .pq-mark:not(:empty) {
    display: flex;
    margin: 2px 0 0;
  }
}
