/* NodeBook — shell extras (help/settings/about links, credit, update bar), Settings and About, the account menu, Account page, members and guest bar, stacked dialog content, print, the site banner, the Admin page. */

/* ---------- shell extras: help/settings/about links, credit, update bar ---------- */

.nav-item--small {
  min-height: 34px;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}

.app-credit {
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-3);
  text-decoration: none;
}

@media (hover: hover) {
  .app-credit:hover {
    color: var(--text);
  }
}

.updatebar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
}

.updatebar[hidden] {
  display: none;
}

.updatebar .btn {
  margin-left: auto;
}

/* ---------- settings / about ---------- */

.linklike {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

.about-hero {
  flex-direction: row;
  align-items: center;
  gap: var(--space-4);
}

.about-hero img {
  flex: none;
  border-radius: var(--radius-sm);
}

.about-hero h2 {
  font-size: var(--text-xl);
}

.credits {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

pre.licence {
  margin: 0;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

@media (max-width: 480px) {
  .about-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.works-with {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.works-with li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-sm);
}

/* Settings / About / Help on the Fleet page: phones only (the sidebar has them on wider screens). */
.more-links {
  display: none;
}

@media (max-width: 820px) {
  .more-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
}

.device-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}

.check:has(input:disabled) {
  opacity: 0.5;
  cursor: default;
}

.account-name {
  padding: 0 var(--space-2) 0 0;
  color: var(--text);
  font-size: var(--text-sm);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The account menu (views/account.js): avatar and name open the fleets, Account, Log out. */
.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 2px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

@media (hover: hover) {
  .menu-btn:hover {
    background: var(--accent-soft);
  }
}

.account-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 700;
}

.account-avatar--lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-lg);
}

/* The fleets in the menu carry a check on the open one; Account and Log out follow apart. */
.more-menu-choice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.more-menu-check {
  flex: none;
  width: 16px;
  display: inline-flex;
}

.more-menu-text {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.more-menu-text small {
  color: var(--text-3);
  font-size: var(--text-xs);
}

.more-menu-group {
  display: flex;
  flex-direction: column;
}

.more-menu-group + .more-menu-item {
  margin-top: var(--space-1);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* A phone's top bar has the avatar only; the name stays for screen readers. */
@media (max-width: 820px) {
  .topbar .account-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* The Account page and the Members card. */
.account-identity,
.member {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.account-fleets,
.member-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-fleet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.account-fleet-text,
.member-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-text {
  flex: 1;
}

.member select {
  width: auto;
}

.member-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.member-invite .field:first-child {
  flex: 1 1 220px;
}

/* A guest on a site with accounts: above the pages, the fleet is this browser's only. */
.guest-bar {
  margin: 0;
  padding: var(--space-1) var(--space-4);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
}

/* A viewer's Deploy tab and device cards: where Apply or Write would be. */
.view-only-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm);
}

/* ---------- stacked dialog content ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stack > p {
  margin: 0;
}

/* config.json "banner": a test site says so on every screen; clicks go through. */
.site-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10000;
  pointer-events: none;
  padding: calc(4px + env(safe-area-inset-top)) 16px 4px;
  background: var(--banner-bg);
  color: var(--banner-text);
  font: 600 13px/1.3 var(--font-sans);
  text-align: center;
  text-shadow: var(--banner-shadow);
}

/* On a phone the bar carries the page title: the banner goes just below it. */
@media (max-width: 820px) {
  .site-banner {
    top: calc(var(--topbar-h) + 1px + env(safe-area-inset-top));
    padding-top: 4px;
  }
}

/* Share: QR code and link; printing shows only #print-area (views/share.js). */
.share-qr {
  display: flex;
  justify-content: center;
}

.qr {
  width: min(240px, 70vw);
  height: auto;
  image-rendering: pixelated;
}

#print-area {
  display: none;
}

/* The fleet key's link code (views/fleet-key.js): the QR, the code as text, the camera while scanning. */
.key-code {
  margin: 0;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}

.fleet-key-code .btn-row {
  justify-content: center;
}

.key-scan {
  width: 100%;
  max-height: 50vh;
  border-radius: var(--radius-md);
  background: var(--code-bg);
  object-fit: cover;
}

@media print {
  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: block;
    color: black;
    background: white;
  }

  .print-labels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8mm;
  }

  .print-label {
    display: flex;
    gap: 4mm;
    align-items: center;
    border: 1px solid black;
    padding: 3mm;
    break-inside: avoid;
    font: 10pt/1.3 system-ui, sans-serif;
  }

  .print-label .qr {
    width: 28mm;
  }

  .print-key {
    max-width: 120mm;
    margin: 0 auto;
    text-align: center;
    font: 11pt/1.4 system-ui, sans-serif;
  }

  .print-key h1 {
    font-size: 16pt;
  }

  .print-key .qr {
    width: 70mm;
  }

  .print-key .mono {
    font: 12pt/1.5 ui-monospace, monospace;
    overflow-wrap: anywhere;
  }

  .print-sheet {
    width: 100%;
    border-collapse: collapse;
    font: 9pt/1.3 system-ui, sans-serif;
  }

  .print-sheet th,
  .print-sheet td {
    border-bottom: 1px solid gray;
    padding: 1mm 2mm;
    text-align: left;
  }
}

/* The Admin page (views/admin.js): the statement on top, the accounts with one open below the list. */
.admin {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.admin-statement {
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 30%, var(--border));
  color: var(--text-on-tint);
}

.admin-statement p {
  font-size: var(--text-md);
}

.admin h4,
.admin h5 {
  font-size: var(--text-md);
  margin: var(--space-2) 0 0;
}

.admin-user {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.admin-user-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

.admin-user-head .btn {
  margin-left: auto;
}

.admin .table td {
  overflow-wrap: anywhere;
}

.admin .table td.mono,
.admin-user-table td:last-child {
  overflow-wrap: normal;
  white-space: nowrap;
}

.admin-shared ul {
  margin: 0;
  padding-left: var(--space-5);
}
