* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  /* 100vh measures against the largest viewport on iOS Safari and Chrome
     mobile, so the composer ends up behind the address bar until the user
     scrolls. 100dvh tracks the currently-visible area, so nothing hides. */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  color: #222;
  background: #fafafa;
}

aside::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background-color: #f3f3f1;
  background-image: url('/image/epistery-base-1000.png');
  /*background-size: var(--pattern-size, 1000px) var(--pattern-size, 1000px);*/
  background-position: center;
  background-repeat: repeat;
  opacity: 0.05;
  overflow:hidden;
  z-index: -1;
}

aside {
  position: relative;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 0 0 280px;
  min-height: 0;
}

.me {
  padding: 12px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 8px;
}
.me-text { flex: 1; min-width: 0; }

/* Drawer pills — three variants share a chunky pill shell.
   - .pill-data     credits/POL strip with a "…" details affordance
   - .pill-identity green outer with a nested white pill (name) + Connect
   - .pill-cta      full green "Initialize Identity" with a "?" affordance
   All are full-width, ~52px tall, deeply rounded (pill geometry). */
.pill {
  display: flex;
  align-items: center;
  margin: 10px 12px;
  height: 48px;
  border-radius: 26px;
  border: 1px solid #c9d2bd;
  background: #fafaf6;
  color: #1a1a1a;
  font-size: 14px;
  overflow: hidden;
  padding: 0 6px 0 0;
  box-sizing: border-box;
}
.pill-cta[hidden] { display: none; }
.pill .pill-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}
.pill .pill-body b { font-weight: 700; color: #1a2f0a; }

/* Affordance "buttons" — pill-shaped, green-tinted, sits on the right */
.pill-affordance {
  height: 36px;
  min-width: 38px;
  padding: 0 12px;
  border: 1px solid #a8c896;
  border-radius: 19px;
  background: #d9ead3;
  color: #1a2f0a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  margin-left: 6px;
  transition: background-color 0.12s;
}
.pill-affordance:hover { background: #c2dab1; }
.pill-affordance:focus { outline: 2px solid #2d5016; outline-offset: 1px; }

/* Credits row uses uppercase labels to match the spec image. */
.pill-data { background: #f4f4ef; }
.pill-data .pill-stat { letter-spacing: 0.5px; text-transform: uppercase; font-size: 13px; }

/* Identity row: green outer container with a nested white "inner" pill on
   the left holding the label, and Connect text on the right. The inner
   pill creates the layered look from the spec image. */
.pill-identity {
  background: #d9ead3;
  border-color: #a8c896;
  padding: 5px;
}
.pill-identity .identity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50% 0 0 50%;
  border: 0px solid #c9d2bd;
  margin-right: 6px;
  flex-shrink: 0;
  z-index:10;
}
.pill-identity .pill-inner {
  flex: 1;
  background: white;
  height: 100%;
  border-radius: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: #222;
  cursor: pointer;
  padding: 0 16px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid #c9d2bd;
}
.pill-identity .pill-inner:hover { background: #f5f9ee; }
.pill-action-text {
  background: transparent;
  border: none;
  color: #1a2f0a;
  font-weight: 600;
  font-size: 14px;
  padding: 0 20px 0 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.pill-action-text:hover { color: #2d5016; }

/* CTA pill — replaces the old identity-mint-cta. Full green, large
   call-to-action with a ? help affordance. */
.pill-cta {
  background: #d9ead3;
  border-color: #a8c896;
  cursor: pointer;
  font-weight: 600;
  color: #1a2f0a;
  font-size: 15px;
  width: calc(100% - 24px);
}
.pill-cta:hover { background: #cfe2c4; }
.pill-cta:disabled { opacity: 0.5; cursor: wait; }
.pill-cta .pill-cta-text { letter-spacing: 0.3px; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.sidebar-footer {
  padding: 12px;
  font-size: 11px;
  color: #888;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-footer a { color: #2d5016; text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }
.sidebar-footer-version { font-family: ui-monospace, Menlo, monospace; color: #aaa; }
.sidebar-footer-version:empty { display: none; }

/* Tabbed settings modal: identity / credits / tokens */
.tabs {
  display: flex;
  width: 100%;
  border-bottom: 1px solid #ddd;
  gap: 2px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: #1a2f0a; background: #f3f3f1; }
.tab.is-active { color: #1a2f0a; border-bottom-color: #2d5016; font-weight: 600; }
.tab-pane { width: 100%; }
.tab-pane[hidden] { display: none; }

/* "→" jump button on the identity recap rows — small unobtrusive nudge to
   the matching tab. */
.detail-value-with-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-jump {
  background: transparent;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 13px;
  color: #1a2f0a;
  cursor: pointer;
  line-height: 1.6;
}
.tab-jump:hover { background: #d9ead3; }

/* Credits detail rows inside the popup */
.credits-detail { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; padding: 4px 0; border-bottom: 1px solid #eee;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #666; font-size: 12px; }
.addr-mini { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #555; }

.icon-btn {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}
.icon-btn:hover { background: #ebebe9; }

.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.modal-card {
  position: relative;
  background: white; padding: 24px; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column; gap: 16px;
  align-items: center;
  max-width: 360px;
  /* Keep the modal usable when keyboard or chrome shrinks the viewport. */
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-card h2 { margin: 0; font-size: 16px; }
.modal-body { font-size: 13px; line-height: 1.45; color: #333; width: 100%; }
.modal-body p { margin: 0 0 10px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #f3f3f1; padding: 1px 4px; border-radius: 3px; }
.qr { background: white; padding: 8px; }
.qr svg { display: block; }
.share-address {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
  text-align: center;
  background: #f3f3f1;
  padding: 8px;
  border-radius: 4px;
  width: 100%;
}
.share-identity { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.share-row { display: flex; flex-direction: column; gap: 2px; }
.share-row.primary .share-address {
  background: #e7f0d8; color: #1a2f0a; font-size: 11px;
}
.share-label { font-size: 11px; color: #888; padding-left: 4px; }
.connect-addr-row { display: flex; gap: 6px; width: 100%; }
.connect-addr-row input {
  flex: 1;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 0;
}
.connect-addr-row button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 13px;
}
.connect-addr-row button.primary { background: #1a2f0a; color: white; border-color: #1a2f0a; }
.share-name {
  font-weight: 600;
  font-size: 14px;
  color: #1a2f0a;
  padding: 2px 6px;
}
.copyable { cursor: pointer; user-select: all; transition: background-color 0.15s; }
.copyable:hover { background: #e9e8e3 !important; }
#me-address.copyable { display: inline-block; padding: 1px 4px; border-radius: 3px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; width: 100%; align-items: stretch; }
.modal-actions button {
  /* Two-line min height so labels like "Promo empty (refills 5/21/2026)"
     don't make the row jump size between states. */
  min-height: 42px;
  line-height: 1.2;
  white-space: normal;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 13px;
}
.modal-actions button:hover { background: #f3f3f1; }
.modal-actions button.primary {
  background: #2d5016;
  border-color: #2d5016;
  color: white;
}
.modal-actions button.primary:hover { background: #1f3a0d; }

.modal-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.form-label { font-size: 12px; color: #555; font-weight: 500; }
.modal-form input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  font-family: ui-monospace, Menlo, monospace;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.modal-form input[type="text"]:focus { outline: none; border-color: #2d5016; }
.form-hint { font-size: 12px; color: #888; margin: 0 0 4px; }
.form-hint code { background: #f3f3f1; padding: 1px 4px; border-radius: 3px; font-size: 11px; }
.form-hint.warn { color: #b14216; }
.modal-section { padding: 8px 14px 14px; }
.form-checkbox { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; font-size: 12px; color: #444; cursor: pointer; }
.form-checkbox input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.form-checkbox a { color: #1f3a0d; }

.me .label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#me-address {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
  display: block;
}

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  padding: 12px 12px 4px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-add {
  background: transparent;
  border: 1px solid #ccc;
  color: #666;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  padding: 0 8px;
  height: 20px;
  cursor: pointer;
}
.section-add:hover { background: #e0e0dc; color: #222; }

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Row stretches full width; the action button is overlaid absolutely on the
   right so the link's clickable area runs edge-to-edge. */
.peer-row {
  display: flex;
  align-items: stretch;
  position: relative;
}
.peer-row a.peer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: inherit;
  text-decoration: none;
  border-left: 3px solid transparent;
  flex: 1;
  min-width: 0;
}
.peer-row a.peer:hover { background: #ebebe9; }
.peer-row.active a.peer { background: #e0e8e0; border-left-color: #2d5016; }
.peer-row.unread .peer-addr,
.peer-row.unread .peer-sub { font-weight: 700; color: #1a1a1a; }

/* Trash button: same look as the section [+] but hover-revealed and floated
   over the row's right edge so the link keeps the full row width. On touch
   devices (no hover) it's always visible so users can find it. */
.row-action {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: 1px solid #ccc;
  color: #666;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  padding: 0 6px;
  height: 20px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 2;
}
.peer-row:hover .row-action,
.peer-row .row-action:focus { opacity: 1; }
.row-action:hover { background: #e0e0dc; color: #222; }
@media (hover: none) {
  .row-action { opacity: 1; }
}
.avatar-sm { width: 28px; height: 28px; border-radius: 4px; flex-shrink: 0; border: 1px solid #ccc}
.peer-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.peer-addr { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.peer-sub {
  font-size: 11px; color: #888;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  background: #b14216; color: white;
  font-size: 10px; padding: 2px 6px; border-radius: 10px;
}

.credits-pill {
  margin: 0 12px 8px;
  padding: 6px 10px;
  background: #1a1f12;
  border: 1px solid #2d5016;
  border-radius: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}
.credits-label { color: #8a9479; }
.credits-value { color: #c8d7a8; font-weight: 600; flex: 1; }
.credits-chain { color: #6f7d5e; font-size: 10px; }

.identity-mint {
  background: #2d5016; color: white; border: none; border-radius: 3px;
  font-size: 11px; padding: 3px 8px; cursor: pointer;
}
.identity-mint:hover { background: #1f3a0d; }
.identity-mint:disabled { opacity: 0.5; cursor: wait; }

.connect-btn {
  padding: 6px 12px;
  background: #2d5016;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.connect-btn:hover { background: #1f3a0d; }

.connect-card { max-width: 360px; width: 90vw; align-items: stretch; }
.connect-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.connect-head h2 { margin: 0; }
.connect-self { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.connect-self .label {
  font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.05em;
  align-self: flex-start;
}
.connect-boxes {
  display: flex;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}
.connect-box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.box-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.06em;
  text-align: center;
}
.qr-target {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
}
.qr-target svg {
  width: 100%;
  height: 100%;
  display: block;
}
.qr-target-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #2ea043;
  color: white;
  font-size: 36px;
  line-height: 64px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
  user-select: none;
}
.qr-target-msg.display {
  opacity: 1;
}

.scan-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3f3f1;
  border: 1px dashed #ccc;
  border-radius: 4px;
  overflow: hidden;
}
.scan-trigger {
  background: transparent;
  border: none;
  width: 100%;
  height: 100%;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
  cursor: pointer;
  text-align: center;
  padding: 8px;
}
.scan-trigger:hover { background: #ebebe9; color: #222; }
.scan-video[hidden] { display: none; }
.scan-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scan-stop[hidden] { display: none; }
.scan-stop {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}
.scan-stop:hover { background: rgba(0,0,0,0.8); }
.scan-status {
  font-size: 12px; color: #555;
  text-align: center;
}

.follow-form {
  display: flex; gap: 4px;
}
.follow-form input {
  flex: 1; padding: 6px 8px; font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  border: 1px solid #ccc; border-radius: 4px;
}
.follow-form button {
  padding: 6px 12px; font-size: 13px;
  border: 1px solid #ccc; background: white; border-radius: 4px; cursor: pointer;
}
.follow-form button:hover { background: #f3f3f1; }

main { display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 1; }

header.main-head {
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: white;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#peer-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

/* Hamburger is hidden on desktop; the sidebar is always visible there. */
.hamburger {
  display: none;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #444;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}
.drawer-backdrop[hidden] { display: none; }

/* Toasts: pinned to the top of the viewport and floated above modal
   backdrops so a failure during a modal flow (e.g. MetaMask dismissed
   during addRivet) is actually visible. The previous block-flow layout
   put them behind the modal where they'd only peek out on phone. */
#error,
#success {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
#error {
  background: #fde6e6; color: #7a1f1f;
  border-bottom: 1px solid #f5c6cb;
}
#success {
  background: #e6f6e6; color: #1f5a1f;
  border-bottom: 1px solid #c6e6c8;
}
@media (max-width: 640px) {
  #error, #success {
    font-size: 16px;
    padding: 14px 16px;
  }
}

.fido-banner[hidden] { display: none; }
.fido-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  color: #78350f;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.fido-banner-text { flex: 1; min-width: 240px; }
.fido-banner-actions { display: flex; gap: 6px; }
.fido-banner-actions button {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #ca8a04;
  border-radius: 4px;
  background: white;
  color: #78350f;
  cursor: pointer;
}
.fido-banner-actions button:hover { background: #fef9c3; }
.fido-banner-actions button.ghost {
  background: transparent;
  border-color: transparent;
}

#messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}

.empty { color: #888; text-align: center; padding: 32px; }

.msg { display: flex; gap: 8px; padding: 4px 0; }
.msg .avatar { width: 32px; height: 32px; border-radius: 4px; flex-shrink: 0; border: 1px solid #ccc }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.msg-from { font-family: ui-monospace, Menlo, monospace; color: #555; }
.msg-time { color: #999; font-size: 11px; }
.msg-source { font-size: 11px; color: #888; }
.msg-chain { font-size: 11px; color: #2d5016; cursor: help; }
.msg-crypto { font-size: 11px; cursor: help; opacity: 0.85; }
.msg-crypto.plain { opacity: 0.5; }
.msg.pending { opacity: 0.65; }
.send-pol-amount { display: flex; gap: 8px; align-items: center; }
.send-pol-amount input { flex: 1; }
.form-hint.warn { color: #b00020; }
.composer-hint { font-size: 11px; padding: 2px 12px; height: 18px}
.composer-hint.on-chain { color: #2d5016; }
.composer-hint.local    { color: #888; }
/* .avatar-sm already sets 28×28 + border-radius + flex-shrink; .peer-icon
   adds the centered glyph and a subtle background so the visual weight
   matches the colored avatar tiles. */
.peer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: #555;
  background: #e0e0dc;
}
.msg-text {
  font-size: 14px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.msg-text p { margin: 2px 0; }
.msg-text code { background: #eee; padding: 0 4px; border-radius: 3px; }

.msg-image {
  display: block;
  margin-top: 8px;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 6px;
  background: #f3f3f1;
  cursor: zoom-in;
}
.mode-board .msg-image {
  max-height: 480px;
  margin-top: 10px;
}

/* Board mode (feeds): post-style cards, newest-first, more breathing room.
   Same .msg markup, different presentation. */
#messages.mode-board {
  background: #efefec;
  padding: 16px;
  gap: 12px;
}
.mode-board .msg {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.mode-board .msg .avatar { width: 40px; height: 40px; }
.mode-board .msg-from { font-weight: 600; font-size: 14px; color: #222; }
.mode-board .msg-time { font-size: 12px; }
.mode-board .msg-text { font-size: 15px; line-height: 1.6; margin-top: 6px; }

.sidebar-empty {
  padding: 8px 12px;
  font-size: 11px;
  color: #aaa;
  font-style: italic;
}

.composer[hidden] { display: none; }
.composer {
  border-top: 1px solid #ddd;
  background: white;
  padding: 8px 12px;
  display: flex; gap: 8px;
  align-items: center;
}
.image-attach {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0;
  width: 40px;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #555;
  flex-shrink: 0;
}
.image-attach:hover { background: #f3f3f1; color: #222; }
#input {
  flex: 1; resize: none; padding: 8px; min-height: 40px; max-height: 200px;
  border: 1px solid #ccc; border-radius: 4px;
  font-family: inherit; font-size: 14px;
}
#send {
  padding: 8px 16px; background: #2d5016; color: white; border: none; border-radius: 4px;
  cursor: pointer; font-weight: 500;
}
#send:disabled { background: #888; cursor: not-allowed; }

/* Attachment preview sits between the message list and the composer so the
   user can see what they're about to send. The ✕ overlays the thumbnail. */
.image-preview[hidden] { display: none; }
.image-preview {
  position: relative;
  align-self: flex-start;
  margin: 0 12px 4px;
  display: inline-block;
}
.image-preview img {
  max-width: 200px;
  max-height: 140px;
  border-radius: 6px;
  border: 1px solid #ddd;
  display: block;
}
.image-preview button {
  position: absolute;
  top: -8px; right: -8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid #b14216;
  background: white;
  color: #b14216;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.image-preview button:hover { background: #b14216; color: white; }

@media (max-width: 720px) {
  .hamburger { display: flex; z-index: 100 }

  /* Drawer slides in from the right. Use transform so it animates and so the
     element stays measurable for screen readers when closed. */
  aside {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 50;
    border-right: none;
    border-left: 1px solid #ddd;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    background-color: #f3f3f1;
    padding-top: 46px;
  }
  aside.open { transform: translateX(0); }

  /* Composer needs a bit more breathing room on phones. */
  #messages { padding: 12px; }
  .composer { padding: 8px; }
}

.section-divider {
  width: 100%;
  height: 12px;
  background-image: linear-gradient(to top, white, transparent);
  border-bottom: 1px solid #eee;
}

#menu-header {
  height: 42px;
}

/* Scrollbars — thin solid bar, no arrows */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--page-border) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--page-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-color-quiet);
}
::-webkit-scrollbar-button {
  display: none;
}

/* ============================================================
   epistery.app additions — sidebar sessions + plugin mount
   ============================================================ */

.main-mount {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 0;
}

.home-pane {
  padding: 32px 24px;
  color: #444;
  max-width: 640px;
  margin: 0 auto;
}
.home-pane h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #2d5016;
}
.home-pane p { font-size: 14px; line-height: 1.5; }

/* ---- home tiles ---- */
.home-pane-tiles { max-width: 760px; }
.home-tiles-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 22px 0 10px;
}
.home-tiles {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.home-tile,
.home-continue-tile {
  display: flex;
  flex: 170px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #d4d4cd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  font: inherit;
  transition: background 120ms ease, border-color 120ms ease;
}
.home-tile:hover,
.home-continue-tile:hover {
  background: #f4f7ee;
  border-color: #2d5016;
}
.home-tile-glyph {
  font-size: 28px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.home-tile-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.home-tile-overline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2d5016;
}
.home-tile-label {
  font-size: 15px;
  font-weight: 600;
  color: #1a2f0a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-tile-desc {
  font-size: 12px;
  color: #777;
}
.home-continue-tile {
  background: #ecefe5;
  border-color: #a8c896;
  padding: 16px 18px;
  margin-top: 12px;
}
.home-continue-tile:hover { background: #dde6cf; }

/* ---- home: quick help / why-this-is-different block ---- */
.home-help {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid #d4d4cd;
  border-radius: 10px;
  background: #fbfbf7;
}
.home-help-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.home-help-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #333;
  margin: 0 0 10px;
}
.home-help-text:last-of-type { margin-bottom: 14px; }
.home-help-warn {
  border-left: 3px solid #b14216;
  padding-left: 10px;
  color: #5a2a14;
}
.home-help-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.home-help-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.home-help-btn:hover:not(:disabled) {
  background: #f3f3f1;
  border-color: #aaa;
}
.home-help-btn.primary {
  background: #2d5016;
  border-color: #2d5016;
  color: white;
}
.home-help-btn.primary:hover { background: #3a661c; }
.home-help-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar-list .sidebar-row {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  text-decoration: none;
  color: #222;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: #f3f3f1; }
.sidebar-row.is-active .sidebar-link {
  background: #ecefe5;
  border-left-color: #2d5016;
  font-weight: 600;
}
.kind-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.sess-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav-title { margin-top: 12px; }
.sidebar-nav li {
  list-style: none;
  padding: 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  text-decoration: none;
  color: #2d5016;
  font-size: 13px;
}
.sidebar-nav a:hover { text-decoration: underline; }
.nav-icon {
  display: inline-block;
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-pending {
  list-style: none;
  padding: 6px 12px;
  font-size: 12px;
  color: #b14216;
  font-style: italic;
}

.form-label-hint {
  color: #888;
  font-weight: 400;
  font-size: 11px;
}
.form-params { display: flex; flex-direction: column; gap: 8px; }

.modal-form select,
.modal-form textarea {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}
.modal-form select:focus,
.modal-form textarea:focus { outline: none; border-color: #2d5016; }
.modal-form textarea { resize: vertical; min-height: 40px; }

/* ---- plugin: message-board ---- */
.plugin-message-board {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.mb-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.mb-list {
  list-style: none;
  margin: 0;
  padding: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mb-post {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: #fafaf6;
  border: 1px solid #e8e7df;
  border-radius: 6px;
}
.mb-from {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #2d5016;
  font-weight: 600;
}
.mb-when { font-size: 11px; color: #888; margin-left: 6px; }
.mb-text { font-size: 14px; line-height: 1.45; color: #222; margin-top: 4px; white-space: pre-wrap; }

.mb-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8e7df;
  background: white;
}
.mb-composer textarea {
  flex: 1;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}
.mb-composer button {
  padding: 6px 16px;
  background: #2d5016;
  color: white;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
.mb-composer button:hover { background: #1f3a0d; }

.mb-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

/* ============================================================
   plugin: wiki
   ============================================================ */
/* Plugin root container. mount.mjs sets rootEl.className = 'plugin-wiki',
   which CLOBBERS the 'main-mount' class sessions.js had applied — so the
   flex-column fill that .main-mount provided is lost unless we restore it
   here (message-board/files have their own .plugin-* rules for the same
   reason). Without this the flex chain has no definite height and the ACE
   editor collapses to ~0px. #main-mount is the flex:1 child of <main>. */
.plugin-wiki {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.wiki-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
/* Wiki tree lives in the session's sidebar expansion now — no aside in the
   main pane. Tree-head sits inside .session-expansion. */
.wiki-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 6px;
}
.wiki-new-doc {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 3px;
  width: 22px;
  height: 22px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}
.wiki-new-doc:hover { background: #ecefe5; }
.wiki-tree-list { list-style: none; padding: 6px 0; margin: 0; }
.wiki-tree-children { list-style: none; padding-left: 14px; margin: 0; display: none; }
.wiki-tree-children.expanded { display: block; }
.wiki-tree-node { padding: 0; }
.wiki-tree-row { display: flex; align-items: center; }
.wiki-tree-twisty {
  flex: 0 0 auto;
  width: 16px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #888;
  font-size: 10px;
  line-height: 1;
  text-align: center;
  transition: transform 120ms ease;
}
.wiki-tree-twisty.empty { cursor: default; visibility: hidden; }
.wiki-tree-node.is-open > .wiki-tree-row > .wiki-tree-twisty { transform: rotate(90deg); }
.wiki-tree-link {
  flex: 1 1 auto;
  display: block;
  padding: 3px 12px 3px 4px;
  color: #2d5016;
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
}
.wiki-tree-link:hover { background: #f3f3f1; }
.wiki-tree-node.is-active > .wiki-tree-row > .wiki-tree-link {
  background: #ecefe5;
  border-left-color: #2d5016;
  font-weight: 600;
}
.wiki-tree-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.wiki-doc {
  flex: 1 1 auto;
  padding: 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
/* Header bar: [lock] [meta...]  <- stretch ->  [new] [edit] [delete] */
.wiki-doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e7df;
}
.wiki-doc-badge { font-size: 14px; flex-shrink: 0; }
.wiki-doc-meta {
  font-size: 12px;
  color: #888;
  display: flex;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.wiki-doc-meta > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wiki-doc-new { color: #b14216; font-style: italic; }

.wiki-doc-actions { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
.wiki-doc-actions button {
  font: inherit;
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.wiki-doc-actions button:hover { background: #f3f3f1; }
.wiki-new { font-size: 16px; line-height: 1; padding: 2px 10px !important; }
.wiki-save { background: #2d5016 !important; color: white !important; border-color: #2d5016 !important; }
.wiki-save:hover { background: #1f3a0d !important; }
.wiki-delete { color: #b14216; }

.wiki-doc-render {
  font-size: 15px;
  line-height: 1.55;
  color: #222;
}
.wiki-doc-render h1 { font-size: 24px; margin-top: 0; }
.wiki-doc-render h2 { font-size: 20px; margin-top: 1em; }
.wiki-doc-render h3 { font-size: 17px; }
.wiki-doc-render pre {
  background: #f3f3f1;
  padding: 10px 12px;
  border-radius: 4px;
  overflow-x: auto;
}
.wiki-doc-render code {
  background: #f3f3f1;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
}
.wiki-doc-render pre code { background: transparent; padding: 0; }
.wiki-doc-render a { color: #2d5016; }
.wiki-doc-render a:hover { text-decoration: underline; }

/* ACE ("brace") editor mount point. ACE manages its own font/scroll inside.
   flex:1 + min-height:0 makes it fill the remaining body height; ACE then
   scrolls its own content when the markdown exceeds the box (no maxLines). */
.wiki-doc-edit {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}
.wiki-doc-edit .ace_editor { border-radius: 4px; }
.wiki-doc-edit.is-focused, .wiki-doc-edit:focus-within { border-color: #2d5016; }

/* ---- breadcrumb ---- */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
}
.crumb {
  color: #2d5016;
  text-decoration: none;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
}
a.crumb:hover { text-decoration: underline; }
.crumb-current {
  color: #222;
  font-weight: 600;
}
.crumb-sep {
  color: #aaa;
  font-size: 14px;
  flex-shrink: 0;
}
.crumbs > .crumb:first-child {
  letter-spacing: 0.06em;
}


/* ---- sidebar: per-session expansion (owned by the mounted plugin) ---- */
.session-expansion {
  display: none;
  font-size: 13px;
}
/* Empty expansions (plugin opted out — e.g. message-board has no internal
   nav) stay hidden so they don't show as dead boxes on the active row. */
.sidebar-row.is-active .session-expansion:not(:empty) {
  display: block;
  padding: 4px 0 8px;
  border-left: 3px solid #2d5016;
  background: #fafaf6;
}
/* User collapsed the active row's expansion by clicking the row again. */
.sidebar-row.is-active.is-collapsed .session-expansion {
  display: none;
}
/* Tree items now nested under .session-expansion — tighten paddings so they
   sit comfortably inside the sidebar column. */
.session-expansion .wiki-tree-list { padding: 2px 0 0; }
.session-expansion .wiki-tree-link {
  padding: 3px 12px 3px 4px;
  font-size: 13px;
}
.session-expansion .wiki-tree-children { padding-left: 12px; }

/* ---- message-board: additions for v0 full features ---- */
/* Body wrapper (replaces the bare .mb-text from the proof-of-mount) */
.mb-body {
  font-size: 14px;
  line-height: 1.5;
  color: #222;
  margin-top: 6px;
}
.mb-body p:first-child { margin-top: 0; }
.mb-body p:last-child { margin-bottom: 0; }
.mb-body pre {
  background: #f3f3f1;
  padding: 8px 10px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
}
.mb-body code {
  background: #f3f3f1;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
}
.mb-body pre code { background: transparent; padding: 0; }

.mb-badge { font-size: 12px; flex-shrink: 0; }
.mb-edited { font-size: 11px; color: #888; font-style: italic; }
.mb-post-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.mb-post:hover .mb-post-actions { opacity: 1; }
.mb-post-actions button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #777;
}
.mb-post-actions button:hover { background: #ecefe5; border-color: #c9d2bd; color: #222; }
.mb-post-actions .mb-del:hover { color: #b14216; border-color: #e5b5a5; }

/* Inline edit-area */
.mb-edit-area {
  width: 100%;
  min-height: 80px;
  font: inherit;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}
.mb-edit-controls {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.mb-edit-controls button {
  font: inherit;
  padding: 3px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.mb-edit-save {
  background: #2d5016 !important;
  color: white !important;
  border-color: #2d5016 !important;
}

/* Comments */
.mb-comments {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border-left: 2px solid #e8e7df;
  margin-left: 12px;
}
.mb-comment {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 13px;
  position: relative;
}
.mb-comment:hover { background: rgba(0, 0, 0, 0.02); }
.mb-comment-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid #ccc;
  flex-shrink: 0;
}
.mb-comment-from {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #2d5016;
  font-weight: 600;
}
.mb-comment-badge { font-size: 10px; }
.mb-comment-when { font-size: 10px; color: #888; }
.mb-comment-text { flex: 1; color: #222; white-space: pre-wrap; }
.mb-comment-del {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 12px;
  cursor: pointer;
  color: #777;
  opacity: 0;
}
.mb-comment:hover .mb-comment-del { opacity: 1; }
.mb-comment-del:hover { background: #ecefe5; color: #b14216; border-color: #e5b5a5; }

.mb-comment-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-left: 12px;
}
.mb-comment-form input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.mb-comment-form input:focus { outline: none; border-color: #2d5016; }
.mb-comment-form button {
  padding: 4px 12px;
  font-size: 13px;
  background: white;
  color: #2d5016;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  cursor: pointer;
}
.mb-comment-form button:hover { background: #ecefe5; }

/* Composer hint (encryption status) */
.mb-composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.mb-composer-hint { font-size: 11px; color: #888; }

/* ---- mode-specific layout ---- */
/* Chat mode keeps the existing compact look (list above, composer below). */
.mb-mode-chat .mb-post { padding: 8px 12px; }

/* Post mode: composer at top, cards bigger + airier, comments expanded. */
.mb-mode-post .mb-composer { order: -1; border-top: none; border-bottom: 1px solid #e8e7df; }
.mb-mode-post .mb-list { padding: 20px 24px; gap: 20px; }
.mb-mode-post .mb-post {
  padding: 16px 18px;
  background: white;
  border: 1px solid #e0dfd7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}
.mb-mode-post .mb-avatar { width: 36px; height: 36px; }
.mb-mode-post .mb-from { font-size: 13px; }
.mb-mode-post .mb-body { font-size: 15px; }

/* ============================================================
   plugin: files
   ============================================================ */
.plugin-files {
  display: flex;
  flex-direction: column;
}
.files-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-height: 0;
}
.files-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #e8e7df;
  background: #fafaf6;
  flex-shrink: 0;
}
.files-back {
  font: inherit;
  padding: 4px 10px;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.files-back:hover { background: #ecefe5; }
.files-badge { font-size: 14px; flex-shrink: 0; }
.files-status {
  flex: 1 1 auto;
  font-size: 12px;
  color: #666;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-status.is-error { color: #b14216; }
.files-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.files-actions button {
  font: inherit;
  padding: 4px 10px;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.files-actions button:hover { background: #ecefe5; }

.files-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  flex: 1 1 auto;
  overflow-y: auto;
}
.files-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  font-size: 14px;
  color: #222;
  border-bottom: 1px solid #f1efe8;
}
.files-row:hover { background: #fafaf6; }
.files-icon { font-size: 18px; flex-shrink: 0; }
.files-name {
  color: #2d5016;
  text-decoration: none;
  font-weight: 500;
  flex-shrink: 0;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-name:hover { text-decoration: underline; }
.files-row-folder .files-name { color: #1f3a0d; font-weight: 600; }
.files-meta {
  flex: 1 1 auto;
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, Menlo, monospace;
}
.files-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.files-row:hover .files-row-actions { opacity: 1; }
.files-row-actions button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 12px;
  cursor: pointer;
  color: #777;
}
.files-row-actions button:hover { background: #ecefe5; border-color: #c9d2bd; color: #222; }
.files-row-actions .files-del:hover { color: #b14216; border-color: #e5b5a5; }

.files-empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 14px;
  color: #888;
  font-style: italic;
}

/* ---- message-board: top bar (badge + settings) ---- */
.mb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #e8e7df;
  background: #fafaf6;
  flex-shrink: 0;
  font-size: 12px;
  color: #555;
}
.mb-bar-badge { font-size: 14px; flex-shrink: 0; }
.mb-bar-status { font-weight: 500; }
.mb-bar-mode { color: #888; }
.mb-bar-actions { margin-left: auto; display: flex; gap: 6px; }

/* In post mode the composer is order:-1 (top). The bar still sits ABOVE
   that — flip the bar's order too so it stays first. */
.mb-mode-post .mb-bar { order: -2; }

/* The composer hint moved out of the form; if any legacy hint slips back in
   it stays neutral. */
.mb-composer-hint { display: none; }

/* ---- gear button shared across plugins ---- */
.mb-settings,
.wiki-settings,
.files-settings {
  background: transparent;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}
.mb-settings:hover,
.wiki-settings:hover,
.files-settings:hover { background: #ecefe5; color: #1a2f0a; }

/* ---- session-settings modal (tabbed full-page) ---- */
#session-settings-modal .session-settings-card {
  width: 92vw;
  max-width: 640px;
  max-height: 90vh;
}
#session-settings-modal .tabs { margin-top: 4px; }
/* Fixed pane height keeps the modal card the same size across tabs so the
   tab strip and Delete/Close actions don't jump when switching. Min-height
   pairs with max-height so short content doesn't collapse the card. */
#session-settings-modal .settings-tab-pane {
  padding: 14px 0 4px;
  height: 60vh;
  min-height: 320px;
  overflow-y: auto;
}
#session-settings-modal .session-settings-actions {
  border-top: 1px solid #eee;
  padding-top: 10px;
  margin-top: 4px;
  justify-content: space-between;
}
#session-settings-modal .modal-actions button.danger {
  background: #b14216;
  color: white;
  border-color: #b14216;
}
#session-settings-modal .modal-actions button.danger:hover {
  background: #8a3210;
  border-color: #8a3210;
}

/* Properties tab — Save row */
.settings-props-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.settings-props-save {
  background: #2d5016;
  color: white;
  border: 1px solid #2d5016;
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
}
.settings-props-save:hover { background: #1f3a0d; }
.settings-props-save:disabled { opacity: 0.6; cursor: wait; }
.settings-props-status { font-size: 12px; color: #666; }
#settings-description {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}
#settings-name {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* New-session description textarea */
#new-session-description {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}

/* ---- MCP keys section inside Connect tab ---- */
.mcp-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}
.mcp-url {
  flex: 1;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  background: #f3f3f1;
  padding: 6px 8px;
  border-radius: 3px;
  overflow-x: auto;
  white-space: nowrap;
}
.mcp-url-copy,
.mcp-reveal-copy {
  background: transparent;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #1a2f0a;
}
.mcp-url-copy:hover,
.mcp-reveal-copy:hover { background: #d9ead3; }

.mcp-subhead {
  margin: 8px 0 6px;
  font-size: 12px;
  color: #555;
  font-weight: 600;
}
.mcp-keys-list-wrap { margin-top: 6px; }
.mcp-keys-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mcp-keys-loading,
.mcp-keys-empty {
  font-size: 12px;
  color: #888;
  padding: 6px 0;
}
.mcp-key-row {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr 2fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #f0f0ec;
  font-size: 12px;
}
.mcp-key-row:last-child { border-bottom: none; }
.mcp-key-nick { font-weight: 600; color: #1a2f0a; }
.mcp-key-role {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #555;
  background: #f3f3f1;
  padding: 1px 6px;
  border-radius: 3px;
  text-align: center;
}
.mcp-key-meta { color: #777; font-size: 11px; }
.mcp-key-revoke {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  color: #777;
}
.mcp-key-revoke:hover { background: #ecefe5; color: #b14216; border-color: #e5b5a5; }

.mcp-issue-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.mcp-issue-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 6px;
}
.mcp-nickname,
.mcp-role {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.mcp-generate {
  background: #2d5016;
  color: white;
  border: 1px solid #2d5016;
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
}
.mcp-generate:hover { background: #1f3a0d; }
.mcp-generate:disabled { opacity: 0.6; cursor: wait; }

.mcp-reveal {
  margin-top: 10px;
  padding: 10px;
  background: #fff8e1;
  border: 1px solid #f0e0a0;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mcp-reveal-token {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  background: white;
  padding: 6px 8px;
  border-radius: 3px;
  border: 1px solid #ddd;
  word-break: break-all;
}
.mcp-reveal-copy { align-self: flex-start; }
.mcp-readonly-hint { color: #777; font-style: italic; margin-top: 6px; }

/* Plugin-supplied settings rows */
.plugin-settings { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.plugin-settings .settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.plugin-settings .settings-label { font-size: 12px; color: #555; min-width: 60px; }
.plugin-settings select {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  flex: 1;
}
.plugin-settings .settings-save {
  padding: 4px 14px;
  background: #2d5016;
  color: white;
  border: 1px solid #2d5016;
  border-radius: 4px;
  cursor: pointer;
}
.plugin-settings .settings-save:hover { background: #1f3a0d; }
.plugin-settings .settings-save:disabled { opacity: 0.6; cursor: wait; }
.plugin-settings .settings-status { font-size: 12px; color: #666; }

/* ---- message-board: attachments ---- */
.mb-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;       /* don't steal vertical space from the post list */
}
.mb-composer-row { display: flex; gap: 8px; align-items: flex-start; }
.mb-composer-row textarea {
  flex: 1;
  min-height: 38px;     /* one comfortable line */
  max-height: 160px;    /* user can resize within this range */
  resize: vertical;
}
.mb-attach {
  background: transparent;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 16px;
  cursor: pointer;
  color: #555;
}
.mb-attach:hover { background: #ecefe5; color: #1a2f0a; }
.mb-attach:disabled { opacity: 0.5; cursor: wait; }

.mb-attach-preview[hidden] { display: none; }
.mb-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f4f4ef;
  border: 1px solid #e0dfd7;
  border-radius: 4px;
}
.mb-attach-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.mb-attach-meta { flex: 1; font-size: 12px; color: #555; }
.mb-attach-remove {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  color: #777;
}
.mb-attach-remove:hover { background: #ecefe5; color: #b14216; border-color: #e5b5a5; }

/* Inline image on a post */
.mb-post-image-link {
  display: block;
  margin-top: 8px;
  max-width: 400px;
}
.mb-post-image {
  max-width: 100%;
  max-height: 360px;
  border-radius: 6px;
  border: 1px solid #e0dfd7;
  display: block;
}
.mb-mode-post .mb-post-image-link { max-width: 600px; }
.mb-mode-post .mb-post-image { max-height: 480px; }

/* ---- files: folder tree in the sidebar subnav ---- */
.session-expansion .files-tree {
  list-style: none;
  margin: 0;
  padding: 2px 0 0;
}
.session-expansion .files-tree-children {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}
.session-expansion .files-tree-node { padding: 0; }
.session-expansion .files-tree-link {
  display: block;
  padding: 3px 12px 3px 24px;
  color: #2d5016;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid transparent;
  margin-left: -3px;
}
.session-expansion .files-tree-link:hover { background: #f3f3f1; }
.session-expansion .files-tree-node.is-active > .files-tree-link {
  background: #ecefe5;
  border-left-color: #2d5016;
  font-weight: 600;
}

/* ---- message-board: send icon + reply pip ---- */
.mb-send {
  font-size: 18px;
  line-height: 1;
  padding: 4px 14px;
}
/* Reply button shares the post-action look but stays neutral (not red) */
.mb-post-actions .mb-reply:hover { color: #2d5016; border-color: #c9d2bd; }

/* ---- loading affordances ---- */
@keyframes spinner-rotate { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #c9d2bd;
  border-top-color: #2d5016;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  vertical-align: middle;
}
.sidebar-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #666;
  list-style: none;
}
.main-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  font-size: 14px;
  color: #666;
}
.main-loading .spinner { width: 18px; height: 18px; border-width: 3px; }

/* ---- session settings: members + share ---- */
.settings-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #eee;
  padding-top: 14px;
  margin-top: 4px;
}
.settings-section:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.settings-section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-members-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- status page ---- */
.status-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}
.status-head h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1a2f0a;
  margin: 0 0 6px;
}
.status-hint {
  font-size: 13px;
  color: #777;
  margin: 0 0 18px;
}
.status-empty {
  font-size: 14px;
  color: #888;
  font-style: italic;
}
.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.status-table th,
.status-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #ecebe5;
  vertical-align: middle;
}
.status-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  font-weight: 600;
}
.status-sess-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1a2f0a;
}
.status-sess-link:hover { text-decoration: underline; }
.status-glyph {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.status-name {
  font-weight: 500;
}
.status-vis {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  background: #f0efe9;
  border-radius: 3px;
  font-size: 10px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-num { font-variant-numeric: tabular-nums; }
.status-pending {
  color: #aaa;
  font-style: italic;
}

/* ---- info pages (Help / Support stubs) ---- */
.info-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px;
}
.info-page h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1a2f0a;
  margin: 0 0 8px;
}
.info-empty {
  font-size: 14px;
  color: #888;
  font-style: italic;
}
.settings-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 4px;
}
.settings-member-row:hover { background: #fafaf6; }
.settings-member-addr {
  flex: 1 1 auto;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-creator-tag {
  color: #2d5016;
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 6px;
}
.settings-member-role,
.settings-member-role-fixed {
  font-size: 12px;
  min-width: 70px;
}
.settings-member-role {
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}
.settings-member-role-fixed {
  padding: 2px 8px;
  color: #666;
  text-transform: lowercase;
}
.settings-member-remove {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 13px;
  cursor: pointer;
  color: #777;
}
.settings-member-remove:hover { background: #ecefe5; color: #b14216; border-color: #e5b5a5; }

.settings-add-member {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.settings-add-from-book {
  flex: 1 1 100%;
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}
.settings-add-addr {
  flex: 1;
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
}

/* Nickname-aware member row */
.settings-member-name {
  font-weight: 600;
  color: #1a2f0a;
  margin-right: 6px;
}
.settings-member-shortaddr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #666;
}

/* New-session member picker */
.member-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.member-picker-selected {
  list-style: none;
  margin: 0;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafaf6;
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.member-picker-empty {
  list-style: none;
  font-size: 12px;
  color: #888;
  font-style: italic;
  align-self: center;
}
.member-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 8px;
  background: #ecefe5;
  border: 1px solid #a8c896;
  border-radius: 12px;
  font-size: 12px;
  color: #1a2f0a;
}
.member-picker-chip-remove {
  background: transparent;
  border: 0;
  color: #2d5016;
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  line-height: 1;
}
.member-picker-chip-remove:hover { color: #b14216; }
.member-picker-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.member-picker-from-book {
  flex: 1 1 100%;
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}
.member-picker-input {
  flex: 1;
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
}
.member-picker-add {
  padding: 4px 12px;
  background: #2d5016;
  color: white;
  border: 1px solid #2d5016;
  border-radius: 4px;
  cursor: pointer;
}
.member-picker-add:hover { background: #1f3a0d; }
.settings-add-role {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}
.settings-add-btn {
  padding: 4px 12px;
  background: #2d5016;
  color: white;
  border: 1px solid #2d5016;
  border-radius: 4px;
  cursor: pointer;
}
.settings-add-btn:hover { background: #1f3a0d; }

/* Share panel */
.settings-share-hint {
  font-size: 12px;
  color: #666;
  margin: 0;
  line-height: 1.4;
}
.settings-share-actions {
  display: flex;
  gap: 6px;
}
.settings-share-actions button {
  font: inherit;
  padding: 4px 12px;
  border: 1px solid #c9d2bd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.settings-share-actions button:hover { background: #ecefe5; }
.settings-share-qr-panel {
  text-align: center;
  padding: 10px;
  background: white;
  border-radius: 4px;
  border: 1px solid #e0dfd7;
}
.settings-share-qr-panel svg { max-width: 220px; height: auto; }
.settings-share-url {
  display: block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  background: #f3f3f1;
  padding: 6px 8px;
  border-radius: 3px;
  word-break: break-all;
  color: #444;
}

/* ---- entypo iconography ----
   Same convention as epistery-host/public/style/static.css. Apply with
   `class="icon icon-<name>"` on a button/span/i — the glyph lands in
   the ::before slot, so you can still nest text or aria-label.        */
@font-face {
  font-family: "toolkit-entypo";
  src: url('/style/toolkit-entypo.eot');
  src: url('/style/toolkit-entypo.eot?#iefix') format('eot'),
       url('/style/toolkit-entypo.woff2') format('woff2'),
       url('/style/toolkit-entypo.woff') format('woff'),
       url('/style/toolkit-entypo.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
.icon:before {
  display: inline-block;
  font-family: "toolkit-entypo";
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.icon-trash:before { content: "\EB72"; }
.icon-check:before { content: "\EA41"; }
.icon-star:before { content: "\EB5B"; }
.icon-star-outlined:before { content: "\EB5A"; }
.icon-circle-with-cross:before { content: "\EA52"; }
.icon-circle-with-plus:before { content: "\EA54"; }
.icon-cog:before { content: "\EA5D"; }
.icon-key:before { content: "\EAD2"; }
.icon-user:before { content: "\EB85"; }
.icon-wallet:before { content: "\EB93"; }
.icon-lock:before { content: "\EAEA"; }
.icon-home:before { content: "\EAC4"; }
.icon-bar-graph:before { content: "\EA29"; }
.icon-info-with-circle:before { content: "\EACD"; }
.icon-lifebuoy:before { content: "\EADE"; }
.icon-plus:before { content: "\EB1C"; }
.icon-cross:before { content: "\EA77"; }
.icon-link:before { content: "\EAE3"; }
.icon-print:before { content: "\EB21"; }
.icon-save:before { content: "\EB3B"; }
.icon-edit:before { content: "\EA8D"; }
.icon-download:before { content: "\EA86"; }
.icon-reply:before { content: "\EB33"; }

/* Reply form was leaking visible because `display: flex` overrode the
   [hidden] attribute (same bug class as .mb-attach-preview earlier). */
.mb-comment-form[hidden] { display: none; }

/* ---- message-board: post image placeholder while fetching ---- */
.mb-post-image-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  background: #f4f4ef;
  border: 1px solid #e0dfd7;
  border-radius: 6px;
  color: #888;
  font-size: 13px;
  min-height: 60px;
  margin-top: 8px;
}
.mb-post-image-loading .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}
.mb-post-image-error {
  color: #b14216;
}

/* ---- address book ---- */

/* Collapsible section header — section-title with a twisty + clickable. */
.section-collapsible {
  cursor: pointer;
  user-select: none;
}
.section-collapsible .section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-twisty {
  display: inline-block;
  font-size: 10px;
  color: #888;
  transition: transform 120ms ease;
  width: 10px;
}
.section-collapsible[aria-expanded="true"] .section-twisty {
  transform: rotate(90deg);
}

.addrbook-list {
  padding: 2px 0 6px;
}
.addrbook-row {
  list-style: none;
  margin: 0;
  padding: 0;
}
.addrbook-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  text-decoration: none;
  color: #222;
  font-size: 13px;
  border-left: 3px solid transparent;
}
.addrbook-link:hover { background: #f3f3f1; }
.addrbook-row.is-active .addrbook-link {
  background: #ecefe5;
  border-left-color: #2d5016;
  font-weight: 600;
}
.addrbook-avatar {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}
.addrbook-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.addrbook-name .addrbook-addr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: #888;
  margin-left: 4px;
}
.addrbook-empty {
  list-style: none;
  padding: 4px 12px 8px;
  font-size: 12px;
  color: #888;
  font-style: italic;
}

/* ---- identity pill: clickable area wrapping avatar + label ---- */
.pill-link {
  flex: 1;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  height: 100%;
}

/* ---- manage identity page ---- */
.identity-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px;
}
.identity-page-head h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  color: #1a2f0a;
}
.identity-page-hint {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 18px;
}
.identity-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 14px;
}
.identity-summary-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  flex-shrink: 0;
}
.identity-summary-info {
  min-width: 0;
}
.identity-summary-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a2f0a;
}
.identity-summary-addr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #555;
  word-break: break-all;
}
.identity-page-mint {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 4px;
  border: 1px solid #2d5016;
  border-radius: 6px;
  background: #2d5016;
  color: white;
  cursor: pointer;
}
.identity-page-mint:hover { background: #3a661c; }

.wallet-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}
.wallet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #ecebe5;
  font-size: 13px;
}
.wallet-item:last-child { border-bottom: none; }
.wallet-item.is-active { background: #f4f7ee; border-left: 3px solid #2d5016; padding-left: 6px; }
.wallet-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wallet-addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wallet-addr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #222;
  cursor: pointer;
}
.wallet-addr:hover { color: #2d5016; }
.wallet-type {
  font-size: 11px;
  color: #888;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wallet-identity-status {
  margin-top: 4px;
  font-size: 11.5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.wallet-identity-label {
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.wallet-identity-value {
  color: #1a2f0a;
}
.wallet-identity-value.muted { color: #999; font-style: italic; }
.wallet-identity-more {
  font-size: 10.5px;
  color: #888;
  font-style: italic;
}
.wallet-item.is-active .wallet-identity-value { font-weight: 600; }
.wallet-source-icon {
  font-size: 12px;
  color: #2d5016;
}
.wallet-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.wallet-btns button {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  color: #888;
  border-radius: 4px;
}
.wallet-btns button:hover { background: #f0f0ec; color: #222; }
.wallet-btns button.btn-delete:hover { color: #b14216; }
.wallet-btns button:disabled { cursor: default; color: #2d5016; }

.wallet-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.add-wallet-btn {
  flex: 1 1 calc(20% - 8px);
  padding: 8px 12px;
  background: white;
  border: 1px dashed #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  font-size: 13px;
}
.add-wallet-btn:hover { background: #f3f3f1; color: #222; }
.add-wallet-btn.web3 {
  border-style: solid;
  border-color: #c08a5a;
  color: #8a5a30;
}
.add-wallet-btn.web3:hover { background: #c08a5a; color: white; }
.add-wallet-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.wallet-feedback {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 4px;
  margin-top: 10px;
  line-height: 1.45;
  word-break: break-word;
}
@media (max-width: 640px) {
  .wallet-feedback { font-size: 15px; padding: 12px; }
}
.wallet-feedback.success { background: #e9f3e0; color: #2d5016; }
.wallet-feedback.error   { background: #fbe9e3; color: #b14216; }
.wallet-feedback.loading { background: #f3f3f1; color: #555; font-style: italic; }

/* Identity-page sections — device vs. identity are deliberately set apart
   so the two concepts don't blur into "the wallets attached to this
   identity." Visual separator between them. */
.identity-section { margin-top: 20px; border-top: 2px solid #d9d9cd; padding-top: 18px; }
.identity-section .settings-section-title { margin-top: 0; }

.signers-subhead, .chooser-subhead {
  font-size: 13px;
  font-weight: 600;
  color: #1a2f0a;
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.signers-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid #ecebe5;
  border-radius: 6px;
  background: #fbfbf8;
}
.signer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #ecebe5;
  font-size: 13px;
}
.signer-item:last-child { border-bottom: none; }
.signer-item.is-self { background: #f4f7ee; }
.signer-icon { font-size: 14px; color: #888; flex-shrink: 0; }
.signer-item.is-self .signer-icon { color: #2d5016; }
.signer-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.signer-name { font-size: 13px; color: #1a2f0a; }
.signer-addr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #555;
  cursor: pointer;
}
.signer-addr:hover { color: #2d5016; }
.signer-self-tag {
  font-size: 11px;
  font-style: italic;
  color: #2d5016;
  background: #e9f3e0;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}
.signers-loading, .signers-empty {
  padding: 10px;
  color: #888;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.signers-add-wrap { margin-top: 8px; }
.signers-add-toggle {
  font-size: 13px;
  color: #2d5016;
  background: transparent;
  border: 1px dashed #2d5016;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
}
.signers-add-toggle:hover { background: #f4f7ee; }
.signers-add-form { margin-top: 10px; padding: 10px; background: #fbfbf8; border-radius: 6px; }
.signers-add-form .form-hint { font-size: 12px; color: #555; margin: 0 0 8px; }
.signers-add-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.signers-add-row input[type="text"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, Menlo, monospace;
}
.signers-add-row .signers-add-label { font-family: inherit; flex: 0 1 140px; }
.signers-add-submit,
.signers-add-cancel {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #2d5016;
}
.signers-add-submit { background: #2d5016; color: white; }
.signers-add-submit:hover { background: #3a661c; }
.signers-add-submit:disabled { opacity: 0.6; cursor: wait; }
.signers-add-cancel { background: white; color: #555; border-color: #ccc; }
.signers-add-cancel:hover { background: #f0f0ec; }

/* 1:N conflict banner — replaces the old "chooser" UI. When chain says
   this wallet is authorized on more than one identity, that's an error
   state to clean up via removeRivet (Leave). Not a feature to pick from. */
.identity-conflict-wrap {
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: #fbe9e3;
  border: 1px solid #e5b5a5;
  border-radius: 6px;
}
.conflict-subhead {
  font-size: 13px;
  font-weight: 600;
  color: #8a3210;
  margin: 0 0 4px;
}
.conflict-explain {
  font-size: 12px;
  color: #555;
  margin: 0 0 8px;
  line-height: 1.5;
}
.conflict-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.conflict-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px dashed #e5b5a5;
  font-size: 13px;
}
.conflict-item:last-child { border-bottom: none; }
.conflict-addr {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #555;
  cursor: pointer;
}
.conflict-addr:hover { color: #8a3210; }
.conflict-active-tag {
  font-size: 11px;
  font-style: italic;
  color: #555;
}
.conflict-spacer { flex: 1; }
.conflict-leave {
  font-size: 12px;
  padding: 4px 10px;
  background: white;
  border: 1px solid #b14216;
  color: #8a3210;
  border-radius: 4px;
  cursor: pointer;
}
.conflict-leave:hover { background: #b14216; color: white; }

/* Pending-invite signer row: hourglass icon + small "pending" tag.
   Inviter-side localStorage; auto-expires after 7 days. */
.signer-item.is-pending .signer-icon { color: #d49b4a; }
.signer-pending-tag {
  font-size: 11px;
  font-style: italic;
  color: #8a5a30;
  background: #fff4e6;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Signer-row Leave / Remove button on the signers list */
.signer-remove-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: white;
  border: 1px solid #c08a5a;
  color: #8a5a30;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.signer-remove-btn:hover { background: #c08a5a; color: white; }
.signer-item.is-self .signer-remove-btn { border-color: #b14216; color: #8a3210; }
.signer-item.is-self .signer-remove-btn:hover { background: #b14216; color: white; }

/* "Get an identity" section — shown when active wallet has no contract */
.get-identity-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.get-identity-wait-hint {
  font-size: 12px;
  color: #888;
  margin: 4px 0 0;
  font-style: italic;
}

/* Identity-invitation modal — shown when reconcileIdentity finds a chain
   offer (this device is a new rivet on a contract). Default is neither
   accept nor decline; user picks. */
.offer-contract-block {
  background: #fbfbf8;
  border: 1px solid #ecebe5;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0;
}
.offer-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}
.offer-row + .offer-row { border-top: 1px dashed #ecebe5; }
.offer-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 64px;
  flex-shrink: 0;
}
.offer-name { font-weight: 600; color: #1a2f0a; }
.offer-contract {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #222;
  word-break: break-all;
  cursor: pointer;
}
.offer-contract:hover { color: #2d5016; }
.offer-warning.warn {
  background: #fff4e6;
  border-left: 3px solid #d49b4a;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin: 8px 0;
}
.offer-decline-hint {
  font-size: 11.5px;
  color: #777;
  margin-top: 8px;
  line-height: 1.45;
}

/* Chain-verified status badge on the Identity page. The dot color encodes
   the verification state at a glance; the text gives the user actionable
   detail. Pending state appears briefly while isAuthorized is in flight. */
.identity-verify {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.4;
}
.identity-verify-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}
.identity-verify-dot.pending { background: #d49b4a; }
.identity-verify-dot.ok      { background: #2d5016; }
.identity-verify-dot.bad     { background: #b14216; }
.identity-verify-text { color: #555; }
.identity-verify-text b { color: #1a2f0a; }
.identity-verify-dot.bad + .identity-verify-text b { color: #8a3210; }
.identity-verify-clear {
  margin-left: 6px;
  font-size: 11.5px;
  padding: 3px 8px;
  border: 1px solid #b14216;
  background: white;
  color: #8a3210;
  border-radius: 4px;
  cursor: pointer;
}
.identity-verify-clear:hover { background: #b14216; color: white; }

/* Mint-modal name availability feedback */
.mint-name-feedback {
  font-size: 12px;
  margin: 4px 0 0;
  min-height: 16px;
  line-height: 1.3;
}
.mint-name-feedback.available { color: #2d5016; }
.mint-name-feedback.taken     { color: #b14216; }
.mint-name-feedback.invalid   { color: #b14216; }
.mint-name-feedback.error     { color: #8a5a30; font-style: italic; }
.mint-name-feedback.checking  { color: #888; font-style: italic; }

/* Invitations section on the Identity page — manual re-check + declined list */
.invitations-section { margin-top: 20px; border-top: 2px solid #d9d9cd; padding-top: 18px; }
.invitations-actions { margin: 10px 0; }
.check-invitations-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  background: white;
  border: 1px solid #2d5016;
  color: #2d5016;
  border-radius: 4px;
  cursor: pointer;
}
.check-invitations-btn:hover { background: #2d5016; color: white; }
.check-invitations-btn:disabled { opacity: 0.6; cursor: wait; }
.icon-cycle.spinning {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.declined-wrap { margin-top: 14px; }
.declined-subhead {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 8px 0 4px;
}
.declined-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px dashed #d9d9cd;
  border-radius: 6px;
  background: #fbfbf8;
}
.declined-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px dashed #ecebe5;
  font-size: 12px;
}
.declined-item:last-child { border-bottom: none; }
.declined-addr {
  font-family: ui-monospace, Menlo, monospace;
  color: #555;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.declined-addr:hover { color: #2d5016; }
.declined-undo {
  font-size: 11px;
  padding: 3px 8px;
  background: white;
  border: 1px solid #c08a5a;
  color: #8a5a30;
  border-radius: 4px;
  cursor: pointer;
}
.declined-undo:hover { background: #c08a5a; color: white; }

/* ---- Contract home page (reachable via /@name and #/address-book/<addr>) */
.chome-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}
.chome-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.chome-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid #d9d9cd;
  background: #f3f3eb;
}
.chome-head-text { min-width: 0; flex: 1; }
.chome-name {
  font-size: 22px;
  margin: 0;
  word-break: break-all;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.chome-sub {
  font-size: 12px;
  color: #888;
  font-weight: 400;
  text-transform: lowercase;
}
.chome-addr {
  display: inline-block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #555;
  background: #f3f3eb;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  cursor: pointer;
}
.chome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.chome-actions button {
  text-align: left;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #d9d9cd;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: inherit;
  color: inherit;
}
.chome-actions button:hover { background: #f7f7ef; }
.chome-actions button.primary {
  background: #6366f1; border-color: #6366f1; color: white;
}
.chome-actions button.primary:hover { background: #4f46e5; }
.chome-actions button.danger { color: #b14216; border-color: #e0c0b0; }
.chome-actions button.danger:hover { background: #fbeae0; }
.chome-actions button:disabled {
  background: #f3f3eb; color: #888; cursor: not-allowed;
  border-color: #e0e0d8;
}
.chome-actions button.primary:disabled {
  background: #c7d2fe; border-color: #c7d2fe; color: #4338ca;
}
.chome-action-hint {
  font-size: 12px; color: #777; font-weight: 400;
}
.chome-actions button.primary .chome-action-hint { color: #e0e7ff; }
.chome-sessions-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin: 0 0 12px;
}
.chome-sessions { list-style: none; margin: 0; padding: 0; }
.chome-session {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px;
}
.chome-session-link {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #d9d9cd;
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.chome-session-link:hover { background: #f7f7ef; }
.chome-session-glyph { font-size: 22px; line-height: 1; }
.chome-session-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1;
}
.chome-session-name { font-weight: 600; }
.chome-session-meta { font-size: 12px; color: #777; }
.chome-session-desc { font-size: 13px; color: #555; margin-top: 4px; }
.chome-follow-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: #6366f1;
  color: white;
  border: 1px solid #6366f1;
  border-radius: 6px;
  cursor: pointer;
}
.chome-follow-btn:hover { background: #4f46e5; }
.chome-follow-btn:disabled {
  background: #e0e7ff; color: #4338ca; cursor: default; border-color: #c7d2fe;
}
.chome-sessions-empty { color: #777; font-style: italic; }
.chome-error { color: #b14216; }
.chome-error-hint { color: #555; font-size: 14px; }

/* Visitor banner — shown on a public session the caller doesn't own and
   isn't a member of. Differs from fido-banner: cool blue (informational,
   not warning), and the only action is "Follow". */
.visitor-banner[hidden] { display: none; }
.visitor-banner {
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
  color: #3730a3;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.visitor-banner-text { flex: 1; min-width: 240px; }
.visitor-banner-actions { display: flex; gap: 6px; }
.visitor-banner-actions button {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid #6366f1;
  border-radius: 4px;
  background: #6366f1;
  color: white;
  cursor: pointer;
}
.visitor-banner-actions button:hover { background: #4f46e5; }
.visitor-banner-actions button:disabled {
  background: #c7d2fe;
  border-color: #c7d2fe;
  cursor: not-allowed;
}

/* ============================================================
   plugin: chatbot
   ============================================================ */
/* Plugin root. mount.mjs sets rootEl.className = 'plugin-chatbot', clobbering
   'main-mount' — restore the flex-column fill (same gotcha as wiki). */
.plugin-chatbot {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cb-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
.cb-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid #e8e7df;
}
.cb-head-meta { flex: 1; font-size: 12px; color: #888; }
.cb-head-actions { display: flex; gap: 6px; }
.cb-clear, .cb-settings {
  font: inherit;
  font-size: 13px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid #d8d7cf;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
}
.cb-clear:hover, .cb-settings:hover { background: #f0efe8; }

.cb-banner {
  margin: 8px 12px 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.cb-banner-info  { background: #eef4ff; color: #234; }
.cb-banner-warn  { background: #fff7e6; color: #6b4e00; }
.cb-banner-error { background: #fdecea; color: #8a1c12; }
.cb-banner-btn {
  font: inherit;
  margin-top: 4px;
  padding: 4px 10px;
  background: #2d5016;
  color: white;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.cb-banner-btn:hover { background: #1f3a0d; }

.cb-transcript {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cb-hello { color: #999; font-size: 14px; text-align: center; margin: auto 0; }

.cb-msg { display: flex; }
.cb-msg-user { justify-content: flex-end; }
.cb-msg-assistant { justify-content: flex-start; }
.cb-msg-body {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.cb-msg-user .cb-msg-body {
  background: #2d5016;
  color: white;
  border-bottom-right-radius: 3px;
  white-space: pre-wrap;
}
.cb-msg-assistant .cb-msg-body {
  background: #fafaf6;
  border: 1px solid #e8e7df;
  color: #222;
  border-bottom-left-radius: 3px;
}
.cb-msg-assistant .cb-msg-body > :first-child { margin-top: 0; }
.cb-msg-assistant .cb-msg-body > :last-child { margin-bottom: 0; }
.cb-msg-assistant .cb-msg-body pre {
  background: #f0efe8;
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
}
.cb-err { color: #8a1c12; }
.cb-empty { color: #999; }

.cb-tool-chip {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 12px;
  color: #2d5016;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cb-tool-spin {
  width: 10px;
  height: 10px;
  border: 2px solid #cfe0bd;
  border-top-color: #2d5016;
  border-radius: 50%;
  display: inline-block;
  animation: cb-spin 0.7s linear infinite;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

.cb-input {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid #e8e7df;
  background: white;
}
.cb-text {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: none;
  max-height: 160px;
  line-height: 1.4;
}
.cb-text:disabled { background: #f5f5f0; color: #aaa; }
.cb-send {
  flex-shrink: 0;
  width: 40px;
  height: 38px;
  background: #2d5016;
  color: white;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}
.cb-send:hover { background: #1f3a0d; }
.cb-send:disabled { background: #b9c4ad; cursor: not-allowed; }
.cb-save {
  flex-shrink: 0;
  height: 38px;
  padding: 0 10px;
  background: transparent;
  color: #555;
  border: 1px solid #d8d7cf;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.cb-save:hover { background: #f0efe8; }
.cb-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* Spinner shown in the send button while the assistant is thinking. */
.cb-send-spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: cb-spin 0.7s linear infinite;
}

/* Saved-conversations list in the chatbot's sidebar expansion. */
.cb-saves { padding: 4px 0 6px; }
.cb-saves-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
  padding: 2px 12px 4px;
}
.cb-saves-list { list-style: none; margin: 0; padding: 0; }
.cb-saves-empty { font-size: 12px; color: #aaa; padding: 2px 12px; }
.cb-save-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 12px;
}
.cb-save-item:hover { background: rgba(0, 0, 0, 0.04); }
.cb-save-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  text-decoration: none;
  color: #2d5016;
  min-width: 0;
}
.cb-save-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-save-meta { font-size: 11px; color: #999; }
.cb-save-del {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0;
}
.cb-save-item:hover .cb-save-del { opacity: 1; }
.cb-save-del:hover { color: #8a1c12; background: rgba(138, 28, 18, 0.1); }

