@font-face {
  font-family: "Press Start Local";
  src: url("/static/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

:root {
  color-scheme: dark;
  --bg: #24272b;
  --bg-2: #1f2226;
  --panel: #31353b;
  --panel-2: #2a2e33;
  --edge-light: #5f666f;
  --edge-dark: #121417;
  --ink: #e3e6ea;
  --muted: #a5adb7;
  --accent: #6f7a87;
  --success: #38b26c;
  --danger: #d34c4c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(92, 102, 111, 0.12), transparent 20%),
    linear-gradient(180deg, #0f1012 0%, #050607 100%);
  background-size:
    18px 18px,
    18px 18px,
    auto,
    auto;
  height: 100vh;
  overflow: hidden;
}

.layout {
  width: min(1280px, calc(100% - 20px));
  height: 100vh;
  margin: 0 auto;
  padding: 10px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.panel {
  background: var(--panel);
  border-top: 2px solid var(--edge-light);
  border-left: 2px solid var(--edge-light);
  border-right: 2px solid var(--edge-dark);
  border-bottom: 2px solid var(--edge-dark);
  border-radius: 0;
  box-shadow: none;
  padding: 10px;
  min-height: 0;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #4a5563 0%, #36404b 100%);
}

.titlebar-text {
  font-family: "Press Start Local", monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.titlebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.titlebar-icon-button {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-top: 2px solid var(--edge-light);
  border-left: 2px solid var(--edge-light);
  border-right: 2px solid var(--edge-dark);
  border-bottom: 2px solid var(--edge-dark);
  background: #2d3238;
  color: #eef3f8;
}

.titlebar-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.titlebar-icon-button:hover {
  filter: brightness(1.08);
}

.titlebar-github-button {
  text-decoration: none;
}

.titlebar-github-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

#openHelpButton {
  color: #f5fbff;
}

#openHelpButton svg {
  width: 18px;
  height: 18px;
  stroke: #dff3ff;
}

#openHelpButton:hover {
  filter: brightness(1.14);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.left-column {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.panel-head h2 {
  display: flex;
  align-items: center;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel-action-button {
  min-width: 0;
  padding: 4px 7px;
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  line-height: 1;
  text-transform: uppercase;
}

.compact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-icon-button {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 22px;
}

.panel-icon-button svg {
  width: 16px;
  height: 16px;
}

.compact-head {
  margin-bottom: 0;
}

.chat-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: start;
  margin-bottom: 8px;
  width: 100%;
}

.chat-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  grid-column: 1;
  width: 100%;
}

.chat-title-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-width: 124px;
}

.chat-clear-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: start;
}

.chat-subtitle-row {
  grid-column: 1;
  min-width: 0;
}

.chat-mode-btn {
  min-width: 0;
  padding: 6px 8px;
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  text-transform: uppercase;
  background: #1f2329;
  color: var(--muted);
  border: 1px solid var(--edge-dark);
}

.chat-mode-btn.is-active {
  background: #3c5367;
  color: #f3f8ff;
  border-color: var(--edge-light);
}

@keyframes dm-unread-glow {
  0%, 100% { color: var(--muted); border-color: var(--edge-dark); }
  50% { color: #7ecfaa; border-color: #4a9a74; }
}

.chat-mode-btn.has-unread {
  animation: dm-unread-glow 1.4s ease-in-out infinite;
}

.chat-peer-row {
  margin-bottom: 6px;
}

.chat-peer-field {
  display: grid;
  gap: 4px;
}

.chat-peer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.chat-peer-field span {
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-peer-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.chat-peer-filter-btn {
  min-width: 0;
  padding: 4px 6px;
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  line-height: 1;
  text-transform: uppercase;
  background: #1f2329;
  color: var(--muted);
  border: 1px solid var(--edge-dark);
  cursor: pointer;
}

.chat-peer-filter-btn:hover {
  background: #24313d;
  color: var(--ink);
}

.chat-peer-filter-btn.is-active {
  background: #35516a;
  color: #f3f8ff;
  border-color: var(--edge-light);
}

.chat-peer-dropdown {
  position: relative;
  min-width: 0;
  flex: 1;
}

.chat-peer-controls {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.chat-peer-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 8px;
  background: var(--surface);
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  gap: 6px;
}

.chat-peer-trigger:hover {
  background: #1e2e3e;
}

.chat-peer-trigger svg {
  flex-shrink: 0;
  color: var(--muted);
}

.chat-peer-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  max-height: 180px;
  overflow-y: auto;
  background: #151d27;
  border: 1px solid var(--edge-light);
  border-top: none;
}

.chat-peer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
  user-select: none;
  border-bottom: 1px solid #1e2a36;
}

.chat-peer-item:last-child {
  border-bottom: none;
}

.chat-peer-item:hover {
  background: #1e2e3e;
}

.chat-peer-item.is-active {
  background: #1a3048;
  color: #a0d4f0;
}

.chat-peer-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-peer-unread {
  flex-shrink: 0;
  margin-left: 6px;
  color: #7ecfaa;
}

@keyframes envelope-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.1; }
}

.chat-peer-unread svg {
  animation: envelope-blink 1.1s ease-in-out infinite;
  display: block;
}

.chat-peer-empty {
  font-size: 10px;
  color: var(--muted);
  padding: 6px 8px;
  font-style: italic;
}

h2 {
  margin: 0;
  font-family: "Press Start Local", monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-panel {
  display: grid;
  gap: 10px;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  background: var(--panel-2);
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.device-status.online {
  background: #24352b;
}

.device-status.offline {
  background: #3a2626;
}

.device-status.loading {
  background: var(--panel-2);
  animation: device-panel-pulse 1.6s ease-in-out infinite;
}

.device-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8b929c;
  flex: 0 0 auto;
  box-shadow: none;
}

.device-status.online .device-dot {
  background: var(--success);
}

.device-status.offline .device-dot {
  background: var(--danger);
}

.device-status.loading .device-dot {
  background: #d6dbe2;
  animation: device-dot-pulse 1.1s ease-in-out infinite;
}

.device-status.loading .device-status-text {
  animation: device-text-fade 1.1s ease-in-out infinite;
}

.device-status-title {
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.device-status-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

@keyframes device-dot-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.55;
  }
}

@keyframes device-text-fade {
  0% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.55;
  }
}

@keyframes device-panel-pulse {
  0% {
    background-color: #2a2e33;
  }
  50% {
    background-color: #31363d;
  }
  100% {
    background-color: #2a2e33;
  }
}

.model-switcher {
  display: grid;
  gap: 6px;
}

.model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

#modelStatusText {
  font-size: 10px;
  line-height: 1.6;
}

.model-node-only-link {
  color: var(--success);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.model-node-only-link:hover {
  color: var(--ink);
}

select {
  width: 100%;
  border-top: 2px solid var(--edge-dark);
  border-left: 2px solid var(--edge-dark);
  border-right: 2px solid var(--edge-light);
  border-bottom: 2px solid var(--edge-light);
  border-radius: 0;
  padding: 7px 8px;
  background: #1f2226;
  color: var(--ink);
  font: inherit;
}

.stack {
  display: grid;
  gap: 6px;
}

.compact-form {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.form-title {
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-panel {
  display: grid;
  min-height: 0;
}

.main-chat-panel {
  grid-template-rows: minmax(0, 1fr);
  padding: 12px;
}

.chat-reply-box {
  display: block;
  min-height: 0;
  padding: 12px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 18, 20, 0.92) 0%, rgba(10, 11, 12, 0.96) 100%);
  background-size:
    18px 18px,
    18px 18px,
    auto;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  overflow: hidden;
}

.chat-reply-label {
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.chat-reply-text {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  height: 100%;
  padding-right: 4px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.7;
  color: #cfd9e8;
}

.chat-empty {
  color: #9ca7b5;
  font-size: 10px;
  align-self: center;
}

.chat-loading {
  color: #a9c8de;
  font-size: 10px;
  align-self: center;
  animation: dm-chat-loading 1s ease-in-out infinite;
}

@keyframes dm-chat-loading {
  0%, 100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.chat-bubble {
  max-width: min(78%, 760px);
  padding: 9px 11px;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  position: relative;
}

/* Delivery status icon — bottom-right corner of outgoing bubble */
.chat-bubble-ack {
  position: absolute;
  bottom: 5px;
  right: 6px;
  width: 12px;
  height: 12px;
  display: block;
  opacity: 0.7;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
/* Pending: clock */
.chat-bubble-ack--pending {
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23aaa' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.5'/%3E%3Cpath d='M8 4.5v3.75l2.5 1.5'/%3E%3C/svg%3E");
}
/* Sent to mesh: single checkmark */
.chat-bubble-ack--sent {
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 8.5l4 4 7-8'/%3E%3C/svg%3E");
}
/* Delivered: double checkmark */
.chat-bubble-ack--delivered {
  opacity: 0.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234caf50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 8.5l3.5 3.5 6-7'/%3E%3Cpath d='M6 8.5l3.5 3.5 6-7'/%3E%3C/svg%3E");
}
/* Failed: X */
.chat-bubble-ack--failed {
  opacity: 0.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ff5252' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8'/%3E%3C/svg%3E");
}

.chat-bubble-meta {
  font-size: 8px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble.user {
  justify-self: end;
  background: #39414b;
  color: #f1f4f7;
}

.chat-bubble.ai {
  justify-self: start;
  background: #273241;
  color: #d7e5f6;
}

.chat-bubble.node {
  justify-self: start;
  background: #2d3641;
  color: #dbe9f8;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: stretch;
  margin-top: 8px;
}

.chat-compose > button {
  height: 42px;
  align-self: stretch;
}

.chat-compose-cashu-btn {
  min-width: 42px;
  max-width: 42px;
  width: 42px;
  min-height: 42px;
  max-height: 42px;
  height: 42px;
  padding: 0;
  border-top-width: 2px;
  border-left-width: 2px;
  border-right-width: 2px;
  border-bottom-width: 2px;
}

.chat-send-button {
  min-width: 42px;
  padding: 0;
}

.chat-send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-compose textarea {
  min-height: 42px;
  height: 42px;
  max-height: 120px;
  padding-top: 10px;
  padding-bottom: 10px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(180deg, #111315 0%, #090a0b 100%);
  background-size:
    18px 18px,
    18px 18px,
    auto;
}

#chatText:focus,
#chatText:focus-visible {
  outline: none;
  box-shadow: none;
}

#walletModal input:focus,
#walletModal input:focus-visible,
#walletModal textarea:focus,
#walletModal textarea:focus-visible,
#walletModal select:focus,
#walletModal select:focus-visible {
  outline: none;
  box-shadow: none;
}

.main-chat-panel .compact-form {
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.main-chat-panel .compact-form.chat-form-dm {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.chat-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


input,
textarea,
button,
pre {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border-top: 2px solid var(--edge-dark);
  border-left: 2px solid var(--edge-dark);
  border-right: 2px solid var(--edge-light);
  border-bottom: 2px solid var(--edge-light);
  border-radius: 0;
  padding: 8px 9px;
  background: #1f2226;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button {
  border-top: 2px solid var(--edge-light);
  border-left: 2px solid var(--edge-light);
  border-right: 2px solid var(--edge-dark);
  border-bottom: 2px solid var(--edge-dark);
  border-radius: 0;
  padding: 7px 10px;
  background: #444b54;
  color: var(--ink);
  cursor: pointer;
}

.log-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.nodes-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 140px;
  max-height: 220px;
}

.nodes-list {
  display: grid;
  gap: 4px;
  overflow: auto;
  min-height: 0;
}

.node-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: var(--panel-2);
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.node-item.weather {
  background: #2b3138;
}

.node-item.snapshot {
  opacity: 0.88;
}

.nodes-online-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 11px;
  font-weight: normal;
  color: var(--success);
  margin-left: 6px;
  letter-spacing: 0;
  line-height: 1;
}

.nodes-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
  flex-shrink: 0;
}

.node-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #69717b;
}

.node-item.online .node-dot {
  background: var(--success);
}

.node-item.offline .node-dot {
  background: #8b4a4a;
}

.node-main {
  min-width: 0;
}

.node-name {
  font-size: 10px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-meta {
  margin-top: 2px;
  font-size: 8px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-actions {
  display: grid;
  grid-template-columns: repeat(2, 24px);
  gap: 5px;
}

.node-action-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #34404d;
  color: #d9ebff;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.node-action-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.node-action-btn.chat-compose-cashu-btn svg {
  width: 28px;
  height: 28px;
}

.node-action-btn.chat-compose-cashu-btn {
  border-top: 2px solid var(--edge-light);
  border-left: 2px solid var(--edge-light);
  border-right: 2px solid var(--edge-dark);
  border-bottom: 2px solid var(--edge-dark);
}

.node-action-btn.node-action-cashu {
  background: #314e3d;
  color: #e6ffe6;
}

.node-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.node-item {
  cursor: pointer;
}

.node-item:hover {
  filter: brightness(1.05);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-shell.hidden {
  display: none;
}

.hidden,
[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
}

.modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(860px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.modal-panel--map {
  width: min(960px, calc(100vw - 32px));
  max-height: min(90vh, 800px);
  height: min(90vh, 800px);
  transition: width 0.2s ease, height 0.2s ease, max-height 0.2s ease, top 0.2s ease, left 0.2s ease, transform 0.2s ease;
}

.modal-panel--map.modal-panel--fullscreen {
  width: 100%;
  height: 100%;
  max-height: 100%;
  top: 0;
  left: 0;
  transform: none;
  border-radius: 0;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nodes-map-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--edge-dark);
}

.nodes-map-container .leaflet-container {
  background: #1a1f25;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
}

.nodes-map-marker-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.nodes-map-marker-online {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 6px var(--success);
}

.nodes-map-marker-offline {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8b4a4a;
  border: 2px solid rgba(255,255,255,0.2);
}

.nodes-map-marker-online-est {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 2px dashed var(--success);
}

.nodes-map-marker-offline-est {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 2px dashed #8b4a4a;
}

.nodes-map-marker-wrap--est {
  opacity: 0.65;
}

.nodes-map-popup-row--est {
  color: #5a7a8a;
}

.nodes-map-label {
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  color: #e0e6ed;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
  letter-spacing: 0.03em;
}

.nodes-map-popup {
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  line-height: 1.5;
  color: #c8d0d8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nodes-map-popup-name {
  font-size: 9px;
  color: #e8f0f8;
  font-weight: bold;
}

.nodes-map-popup-row {
  font-size: 8px;
  color: #8a9aaa;
}



.nodes-map-container .leaflet-popup-content-wrapper {
  background: #252b32;
  color: #c8d0d8;
  border: 1px solid #3a4450;
  border-radius: 2px;
  box-shadow: none;
}

.nodes-map-container .leaflet-popup-tip {
  background: #252b32;
}

.nodes-map-container .leaflet-popup-content {
  margin: 8px 10px;
}

.nodes-map-container .leaflet-control-zoom a {
  background: #252b32;
  color: #c8d0d8;
  border-color: #3a4450;
}

.nodes-map-container .leaflet-control-zoom a:hover {
  background: #3a4450;
}

.nodes-map-container .leaflet-control-attribution {
  background: rgba(26, 31, 37, 0.85) !important;
  color: #4a5a6a !important;
  border-top: 1px solid #2a3540;
}

.nodes-map-container .leaflet-control-attribution a {
  color: #5a7a8a !important;
}

.nodes-map-toggle-control {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.nodes-map-toggle-btn {
  display: block;
  padding: 5px 8px;
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  line-height: 1;
  background: #252b32;
  color: #6a7a8a;
  border: 1px solid #3a4450;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}

.nodes-map-toggle-btn:hover {
  background: #2e3a45;
  color: #c8d0d8;
}

.nodes-map-toggle-btn--active {
  background: #1a3040;
  color: #4a9eff;
  border-color: #4a9eff;
}

.nodes-map-hops-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  height: 28px;
  border: 1px solid #3a4450;
  border-radius: 3px;
  background: #252b32;
  box-sizing: border-box;
}

.nodes-map-hops-label {
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  color: #6a7a8a;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.nodes-map-hops-control.hidden {
  display: none;
}

.nodes-map-hops-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: #3a4a55;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.nodes-map-hops-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #4a9eff;
  cursor: pointer;
}

.nodes-map-hops-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #4a9eff;
  border: none;
  cursor: pointer;
}

/* Radius style toggle button */
.nodes-map-style-btn {
  width: 28px;
  height: 16px;
  padding: 0;
  border: 1px solid #3a4a55;
  border-radius: 3px;
  background: #1e2a35;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

/* fill style preview — single filled circle */
.nodes-map-style-btn--fill::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.25);
  border: 1.5px solid #4caf50;
}

/* rings style preview — concentric mini-rings drawn with box-shadow */
.nodes-map-style-btn--rings::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.35);
  border: 1.5px solid #4caf50;
  box-shadow:
    0 0 0 3px rgba(255, 193, 7, 0.18),
    0 0 0 3px #ffc10755,
    0 0 0 6px rgba(255, 112, 67, 0.12),
    0 0 0 6px #ff704322;
}

.nodes-map-style-btn:hover {
  border-color: #5a7a8a;
  background: #2a3a45;
}

.nodes-map-legend {
  background: rgba(18, 26, 32, 0.88);
  border: 1px solid #2e3a45;
  border-radius: 5px;
  padding: 7px 10px;
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  color: #a0b0b8;
  line-height: 1.6;
  pointer-events: none;
}

.nodes-map-legend-title {
  color: #c8d0d8;
  font-size: 9px;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.nodes-map-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nodes-map-legend-line {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.nodes-map-legend-line--dashed {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px dashed;
  flex-shrink: 0;
}

.nodes-map-legend-divider {
  border-top: 1px solid #2e3a45;
  margin: 4px 0;
}

/* Animated hover link lines (Leaflet SVG path elements) */
.map-link-hover-flow {
  stroke-dasharray: 10 7;
  animation:
    map-link-fade-in 0.25s ease-out forwards,
    map-link-flow 1.4s linear 0.25s infinite;
}

@keyframes map-link-fade-in {
  from { stroke-opacity: 0; }
  to   { stroke-opacity: var(--link-opacity, 0.8); }
}

@keyframes map-link-flow {
  to { stroke-dashoffset: -34; }
}

.nodes-map-role-legend {
  pointer-events: auto;
  min-width: 110px;
}

.nodes-map-role-item {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  transition: opacity 0.15s;
}

.nodes-map-role-item:hover {
  background: rgba(255,255,255,0.06);
}

.nodes-map-role-item--dim {
  opacity: 0.3;
}

.nodes-map-role-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.modal-head {
  margin-bottom: 0;
}

.help-default-view {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.help-footer-actions {
  display: block;
}

.help-donate-button {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  background: #425745;
  color: #eff7f0;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  line-height: 1;
}

.modal-close {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  line-height: 1;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  align-content: start;
}

.model-manager-panel {
  width: min(760px, calc(100vw - 32px));
}

.ai-settings-panel {
  width: min(920px, calc(100vw - 32px));
}

.help-panel {
  width: min(760px, calc(100vw - 32px));
}

.model-manager-status {
  min-height: 18px;
}

.model-manager-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.model-manager-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.ai-settings-layout {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
}

.ai-settings-meta {
  display: grid;
  gap: 2px;
  padding: 10px;
}

.ai-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.ai-settings-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-settings-field {
  display: grid;
  gap: 4px;
  font-size: 9px;
  color: var(--muted);
}

.ai-settings-field span {
  color: var(--muted);
}

.ai-settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--ink);
}

.ai-toggle-checkbox {
  width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

#aiSettingsInstructions {
  min-height: 148px;
  line-height: 1.6;
}

.ai-settings-actions {
  display: flex;
}

.ai-settings-actions button {
  width: 100%;
}

.model-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #20242a;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.model-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.model-card-title {
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink);
}

.model-card-meta {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.6;
}

.model-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-tag {
  padding: 3px 6px;
  background: #38404a;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  line-height: 1.2;
  text-transform: uppercase;
  color: #d7e5f6;
}

.model-tag.current {
  background: #284033;
  color: #dff6e7;
}

.model-tag.available {
  background: #3a3f47;
}

.model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-actions button {
  min-width: 0;
  padding: 5px 8px;
  font-size: 9px;
}

.model-empty {
  color: var(--muted);
  font-size: 10px;
  padding: 8px 0;
}

.help-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.help-donate-view {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.donate-title-section {
  justify-items: center;
}

.donate-project-note {
  width: 100%;
  text-align: center;
  color: #dbe3ec;
  font-size: 13px;
  line-height: 1.5;
}

.donate-list {
  display: grid;
  gap: 8px;
}

.donate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #1f2329;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.donate-meta {
  min-width: 0;
}

.donate-chain {
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  line-height: 1.4;
  color: #d7e5f6;
  text-transform: uppercase;
}

.donate-address {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink);
  word-break: break-all;
}

.donate-copy-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #36404b;
}

.donate-copy-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.donate-copy-button.copied {
  background: #2f7a4a;
  color: #f1fff7;
  animation: copy-ok 700ms ease-out;
}

@keyframes copy-ok {
  0% {
    background: #5ad08a;
    transform: scale(1.03);
  }
  100% {
    background: #2f7a4a;
    transform: scale(1);
  }
}

.help-copy {
  display: grid;
  gap: 8px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink);
}

.help-copy p {
  margin: 0;
}

.modal-section {
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #242830;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  min-height: 0;
  align-content: start;
}

.modal-section-wide {
  grid-column: 1 / -1;
}

.modal-panel--node {
  width: min(780px, calc(100vw - 32px));
}

.node-modal-head {
  align-items: flex-start;
}

.node-modal-head-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.node-modal-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-modal-head-title .node-dot {
  flex: 0 0 8px;
  margin-top: 1px;
}

.node-dot--online { background: var(--success); }
.node-dot--offline { background: #8b4a4a; }

.node-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.node-modal-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  line-height: 1;
  text-transform: uppercase;
  background: var(--panel-2);
  color: var(--ink);
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  cursor: pointer;
  white-space: nowrap;
}

.node-modal-action-btn svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--muted);
}

.node-modal-action-btn:hover {
  filter: brightness(1.15);
}

.node-modal-action-btn--pending {
  opacity: 0.6;
  cursor: wait;
  animation: locate-pulse 1.2s ease-in-out infinite;
}

.node-modal-action-btn--success {
  color: #4caf50;
  border-color: #4caf50;
}

.node-modal-action-btn--success svg {
  color: #4caf50;
}

@keyframes locate-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

.node-modal-body {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  align-content: start;
}

.node-modal-top {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.node-modal-right-col {
  display: grid;
  gap: 6px;
  align-content: start;
}

.node-modal-details {
  background: #242830;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.node-modal-details-toggle {
  padding: 6px 8px;
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.node-modal-details-toggle::before {
  content: "▶";
  font-size: 7px;
  transition: transform 0.15s;
}

.node-modal-details[open] > .node-modal-details-toggle::before {
  transform: rotate(90deg);
}

.node-modal-details-toggle::-webkit-details-marker {
  display: none;
}

.modal-pre--sm {
  min-height: 0;
  max-height: 160px;
}

.modal-label {
  font-family: "Press Start Local", monospace;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.modal-kv {
  display: grid;
  gap: 4px;
}

.modal-kv-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  font-size: 10px;
  line-height: 1.5;
  align-items: start;
}

.modal-k {
  color: var(--muted);
  white-space: nowrap;
}

.modal-v {
  color: var(--ink);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.modal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  min-height: 32px;
}

.modal-port {
  padding: 4px 8px;
  background: #38404a;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}

.modal-pre {
  margin: 0;
  min-height: 120px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  background: #1f2226;
  border-top: 1px solid var(--edge-dark);
  border-left: 1px solid var(--edge-dark);
  border-right: 1px solid var(--edge-light);
  border-bottom: 1px solid var(--edge-light);
  color: #d7e5f6;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-head .chat-subtitle {
  margin-top: 4px;
}

.node-empty {
  color: var(--muted);
  font-size: 10px;
  padding: 8px;
}

.log {
  display: grid;
  gap: 4px;
  overflow: auto;
  min-height: 0;
}

.log-item {
  position: relative;
  border-radius: 0;
  padding: 6px 8px;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  background: var(--panel-2);
}

.log-copy-btn {
  position: absolute;
  top: 5px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.log-item:hover .log-copy-btn {
  opacity: 1;
}

.log-copy-btn:hover {
  color: var(--fg);
}

.log-item.in {
  border-left: 3px solid var(--success);
  background: #24352b;
}

.log-item.out {
  border-left: 3px solid #8aa4c8;
  background: #273241;
}

.log-meta {
  color: var(--muted);
  font-size: 8px;
  margin-bottom: 2px;
  line-height: 1.6;
}

.log-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 10px;
  line-height: 1.7;
}

/* Firefox fallback only. In Chromium, non-auto scrollbar-color/width
   can override ::-webkit-scrollbar styling and force native rendering. */
@supports (-moz-appearance: none) {
  * {
    scrollbar-width: thin;
    scrollbar-color: #566170 #1a1d21;
  }
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  border-radius: 0;
  -webkit-appearance: none;
}

*::-webkit-scrollbar-track {
  background: #1f242b !important;
  border-top: 1px solid var(--edge-dark) !important;
  border-left: 1px solid var(--edge-dark) !important;
  border-right: 1px solid var(--edge-light) !important;
  border-bottom: 1px solid var(--edge-light) !important;
  border-radius: 0 !important;
  -webkit-appearance: none;
}

*::-webkit-scrollbar-thumb {
  background: #4a525d !important;
  border-top: 1px solid var(--edge-light) !important;
  border-left: 1px solid var(--edge-light) !important;
  border-right: 1px solid var(--edge-dark) !important;
  border-bottom: 1px solid var(--edge-dark) !important;
  border-radius: 0 !important;
  min-height: 28px;
  -webkit-appearance: none;
}

*::-webkit-scrollbar-corner {
  background: #1a1d21;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 12px;
  height: 14px;
  background-color: #4a525d !important;
  background-image: none !important;
  border-top: 1px solid var(--edge-light) !important;
  border-left: 1px solid var(--edge-light) !important;
  border-right: 1px solid var(--edge-dark) !important;
  border-bottom: 1px solid var(--edge-dark) !important;
  border-radius: 0 !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 8px 8px;
  -webkit-appearance: none;
}

*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:vertical:decrement:single-button,
*::-webkit-scrollbar-button:vertical:increment:single-button,
*::-webkit-scrollbar-button:single-button:vertical:start {
  display: block;
}

*::-webkit-scrollbar-button:single-button:vertical:decrement,
*::-webkit-scrollbar-button:vertical:decrement:single-button,
*::-webkit-scrollbar-button:single-button:vertical:start {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 2 L8 6 H2 Z' fill='%23d8e2ef'/%3E%3C/svg%3E") !important;
}

*::-webkit-scrollbar-button:single-button:vertical:increment,
*::-webkit-scrollbar-button:vertical:increment:single-button,
*::-webkit-scrollbar-button:single-button:vertical:end {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 4 L8 4 L5 8 Z' fill='%23d8e2ef'/%3E%3C/svg%3E") !important;
}

/* Hide duplicate WebKit split buttons (double-button mode). */
*::-webkit-scrollbar-button:double-button,
*::-webkit-scrollbar-button:double-button:vertical,
*::-webkit-scrollbar-button:double-button:vertical:start,
*::-webkit-scrollbar-button:double-button:vertical:end,
*::-webkit-scrollbar-button:double-button:vertical:decrement,
*::-webkit-scrollbar-button:double-button:vertical:increment {
  display: none !important;
}

*::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.08);
}

*::-webkit-scrollbar-thumb:active {
  filter: brightness(0.92);
}

.log,
.nodes-list,
.modal-grid,
.modal-pre,
.chat-reply-text,
textarea,
.wallet-modal-body,
.wallet-history-shell,
.wallet-view-content,
.wallet-history-table tbody {
  scrollbar-color: auto;
  scrollbar-width: auto;
}

.titlebar-wallet-button {
  color: #f0f6ff;
}

.titlebar-wallet-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wallet-panel {
  width: min(420px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 40px));
  position: relative;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--panel);
  background-size: 18px 18px, 18px 18px, auto;
}

#walletMnemonicBlock:not(.hidden) {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--panel);
  border: none;
}

.wallet-modal-body {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  padding-right: 0;
}

.wallet-view-content {
  min-height: 0;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 6px;
  padding-right: 2px;
}

.wallet-view-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
  align-content: start;
}

.wallet-view-panel[hidden] {
  display: none !important;
}

.wallet-home-head,
.wallet-screen-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

#walletPanelSettings .wallet-screen-head {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: 0;
  padding-top: 0;
  padding-bottom: 6px;
  background: var(--panel);
}

#walletPanelSettings {
  margin-top: 0;
  padding-top: 0;
  gap: 8px;
}

.wallet-home-head h3,
.wallet-screen-head h3 {
  margin: 0;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  line-height: 1.4;
  text-transform: uppercase;
}

.wallet-home-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  text-transform: uppercase;
}

.wallet-back-button {
  min-width: 56px;
  padding: 5px 7px;
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  text-transform: uppercase;
  background: #303843;
}

.wallet-overview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.wallet-balance-card {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
  background: linear-gradient(180deg, #1d2733 0%, #151d27 100%);
  border-top: 1px solid #68788a;
  border-left: 1px solid #68788a;
  border-right: 1px solid #0d1117;
  border-bottom: 1px solid #0d1117;
}

.wallet-balance-label {
  font-size: 10px;
  color: #9fb2c6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wallet-balance-value {
  font-family: "Press Start Local", monospace;
  font-size: 14px;
  line-height: 1.35;
  color: #f2f8ff;
}

.wallet-balance-sub {
  font-size: 11px;
  color: #93a5b7;
  margin-bottom: 0;
}

.wallet-quick-actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  overflow: visible;
  padding-bottom: 2px;
}

.wallet-toolbar {
  position: relative;
  z-index: 3;
  background: linear-gradient(180deg, #1e2329 0%, #171b21 100%);
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 2px solid #0d1117;
  padding: 5px;
}

.wallet-quick-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  height: 58px;
  padding: 0 2px;
  flex: 0 0 auto;
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  text-transform: uppercase;
  background: transparent;
  color: #6a7d91;
  border-top: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}

.wallet-quick-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wallet-quick-button span {
  font-size: 5.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: inherit;
}

.wallet-quick-button:hover {
  color: #a8bccf;
}

.wallet-quick-button:active {
  background: rgba(90, 143, 176, 0.15);
  color: #c8dff0;
  transform: translateY(1px);
}

.wallet-quick-button.is-active {
  background: transparent;
  color: #c8dff0;
  border-top-color: #5a8fb0;
}

.wallet-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  overflow: visible;
}

.wallet-status-badge strong.status-ok {
  color: #6fcf97;
}

.wallet-status-badge strong.status-err {
  color: #eb5757;
}

.wallet-status-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #1a1e24;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.wallet-status-badge span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wallet-status-badge strong {
  font-size: 10px;
  line-height: 1.2;
  color: var(--ink);
}

.wallet-home-copy {
  display: grid;
  gap: 5px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--ink);
}

.wallet-home-copy p {
  margin: 0;
}

.wallet-summary-card {
  display: grid;
  gap: 12px;
  padding: 14px 12px;
  background: #1f2329;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.wallet-summary-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.wallet-summary-route,
.wallet-summary-activity {
  display: grid;
  gap: 4px;
}

.wallet-summary-route span,
.wallet-summary-activity span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.wallet-route-preview {
  padding: 6px 7px;
  background: #171b20;
  border-top: 1px solid var(--edge-dark);
  border-left: 1px solid var(--edge-dark);
  border-right: 1px solid var(--edge-light);
  border-bottom: 1px solid var(--edge-light);
  font-size: 9px;
  color: #dbe6f4;
  word-break: break-all;
}

.wallet-inline-action {
  min-width: 0;
  padding: 6px 10px;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  text-transform: uppercase;
  background: #364a5a;
}

.wallet-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-content: start;
}

.wallet-field {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.wallet-field span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.wallet-field-wide {
  grid-column: 1 / -1;
}

.wallet-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.swap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.swap-info-popup {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.swap-info-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(160,190,220,0.25);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.swap-info-btn:hover {
  color: var(--ink);
  border-color: rgba(160,190,220,0.55);
}


.wallet-form-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

#walletSendForm button[type="submit"] {
  background: #2f586f;
  color: #f0f8ff;
}

.wallet-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: start;
}

.wallet-inline-row button {
  min-width: 78px;
  font-size: 8px;
  padding: 5px 7px;
}

.wallet-request-form {
  padding: 6px;
  background: #242830;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.wallet-section {
  background: #242830;
}

.wallet-history-shell {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.wallet-history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 9px;
  line-height: 1.45;
}

.wallet-history-table thead,
.wallet-history-table tbody {
  display: block;
}

.wallet-history-table thead tr,
.wallet-history-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.wallet-history-table tbody {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}

.wallet-history-table th,
.wallet-history-table td {
  text-align: left;
  padding: 4px 5px;
  border-top: 1px solid #46505b;
}

.wallet-history-table th {
  position: sticky;
  top: 0;
  background: #2b3138;
  color: #dbe6f4;
  font-family: "Press Start Local", monospace;
  font-size: 7px;
  text-transform: uppercase;
}

.wallet-history-table td {
  color: var(--ink);
}

.wallet-history-shell .node-empty {
  padding: 8px 2px;
}

.wallet-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 9px;
}

.wallet-checkbox input {
  width: 16px;
  height: 16px;
  padding: 0;
  flex: 0 0 auto;
}

#walletGeneratedRequest,
#walletReceiveId {
  font-size: 9px;
}

.wallet-balance-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallet-balance-sub {
  font-size: 11px;
  color: #93a5b7;
}

.wallet-icon-button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: #7a9ab8;
  cursor: pointer;
  flex: 0 0 auto;
}

.wallet-icon-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wallet-icon-button svg[hidden] {
  display: none !important;
}

.wallet-icon-button:hover {
  color: #c2d9f0;
}

.wallet-qr-block {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.wallet-qr-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 184px;
  height: 184px;
  background: #151d27;
  border-top: 1px solid var(--edge-dark);
  border-left: 1px solid var(--edge-dark);
  border-right: 1px solid var(--edge-light);
  border-bottom: 1px solid var(--edge-light);
}

.wallet-qr-loading {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.wallet-qr-img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
}

.wallet-no-wallet-notice {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #1f2329;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  font-size: 9px;
  color: var(--muted);
}

.wallet-create-block,
.wallet-mnemonic-block {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: #1a2330;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.wallet-create-btn {
  background: #2f586f;
  color: #f0f8ff;
}

.wallet-danger-btn {
  background: #5a2828;
  color: #f8e8e8;
}

.wallet-mnemonic-warning {
  color: #e8b84e !important;
}

.wallet-mnemonic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.wallet-mnemonic-word {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  background: #171b20;
  border-top: 1px solid var(--edge-dark);
  border-left: 1px solid var(--edge-dark);
  border-right: 1px solid var(--edge-light);
  border-bottom: 1px solid var(--edge-light);
  font-size: 10px;
  color: #dbe6f4;
}

.wallet-mnemonic-num {
  color: var(--muted);
  font-size: 8px;
  min-width: 16px;
  flex: 0 0 auto;
}

.wallet-kv-block {
  display: grid;
  gap: 2px;
  padding: 6px 0;
}

.wallet-kv-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 6px;
}

.wallet-k {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.wallet-v {
  font-size: 11px;
  color: #dbe6f4;
  text-align: right;
  word-break: break-all;
}

.wallet-mint-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wallet-mint-dir-link {
  font-size: 9px;
  color: #5a8fb0;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.wallet-mint-dir-link:hover {
  color: #8abcd4;
  opacity: 1;
}

.wallet-fund-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #1f2329;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
}

.wallet-row-in td:first-child {
  color: #6fcf97;
}

.wallet-row-out td:first-child {
  color: #e87b7b;
}

.wallet-balance-card-secondary {
  background: linear-gradient(180deg, #1a2224 0%, #111618 100%);
  border-color: #3a4a52;
}

.wallet-balance-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-fund-shortcut {
  padding: 3px 8px;
  font-family: "Press Start Local", monospace;
  font-size: 8px;
  text-transform: uppercase;
  background: #2f586f;
  color: #f0f8ff;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.wallet-fund-shortcut:hover {
  background: #3a6a82;
}

.wallet-balance-secondary {
  font-size: 11px;
  color: #8aa0b0;
}

.wallet-balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  margin-bottom: 8px;
  background: #1a2633;
  border-top: 1px solid var(--edge-light);
  border-left: 1px solid var(--edge-light);
  border-right: 1px solid var(--edge-dark);
  border-bottom: 1px solid var(--edge-dark);
  font-size: 9px;
  color: var(--muted);
}

.wallet-balance-pill strong {
  color: #f2f8ff;
  font-size: 10px;
}

.wallet-receive-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
}

.wallet-receive-tab {
  padding: 8px 6px;
  font-family: "Press Start Local", monospace;
  font-size: 10px;
  text-transform: uppercase;
  background: #1f2329;
  color: var(--muted);
  border: 1px solid var(--edge-dark);
  cursor: pointer;
}

.wallet-receive-tab.is-active {
  background: #3c5367;
  color: #f3f8ff;
  border-color: var(--edge-light);
}

.wallet-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 7px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wallet-section-divider::before,
.wallet-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #3a4249;
}

.wallet-token-card {
  margin-top: 10px;
  border-radius: 8px;
  background: #141a22;
  border: 1px solid rgba(100,160,220,0.15);
  overflow: hidden;
}

.wallet-token-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(100,160,220,0.07);
  border-bottom: 1px solid rgba(100,160,220,0.1);
}

.wallet-token-card-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.wallet-token-copy-btn {
  font-size: 10px !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  background: rgba(100,160,220,0.15) !important;
  border: 1px solid rgba(100,160,220,0.25) !important;
  color: #8ab4cc !important;
  cursor: pointer;
  line-height: 1.4;
  font-family: inherit;
}

.wallet-token-copy-btn:hover {
  background: rgba(100,160,220,0.25) !important;
  color: #c0ddf0 !important;
}

.wallet-token-code {
  padding: 10px 12px;
  font-family: monospace;
  font-size: 9.5px;
  color: #7aa8c2;
  word-break: break-all;
  line-height: 1.6;
  user-select: all;
  letter-spacing: 0.02em;
}

.wallet-mint-info {
  margin-top: 4px;
  padding: 5px 7px;
  background: #1a2a1a;
  border-left: 2px solid #4caf50;
  font-size: 9px;
  color: #9ed49e;
}

.cashu-pending-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  background: #1f2329;
  border-top: 1px solid #3a4249;
  font-size: 9px;
}

.cashu-pending-amount {
  font-weight: bold;
  color: #f2f8ff;
  min-width: 60px;
}

.cashu-pending-time {
  color: var(--muted);
  flex: 1;
  font-size: 10px;
}

.cashu-check-btn {
  font-size: 9px;
  padding: 3px 7px;
  background: #2f586f;
}

.wallet-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.wallet-seed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wallet-seed-toggle {
  width: 26px;
  height: 26px;
  color: #7a9ab8;
}

.wallet-seed-toggle:hover {
  color: #c2d9f0;
}

.wallet-icon-button.copied {
  color: #6fcf97;
}

@media (max-width: 1120px) {
  body {
    height: auto;
    overflow: auto;
  }

  .layout {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .left-column {
    grid-template-rows: auto auto auto;
  }

  .log-panel {
    max-height: 320px;
  }

  .log {
    max-height: 260px;
  }

  .chat-panel {
    min-height: 480px;
  }

  .main-chat-panel {
    grid-template-rows: minmax(320px, 1fr);
  }

  .chat-title-line {
    flex-wrap: wrap;
  }

  .chat-title-main {
    flex-wrap: wrap;
  }

  .chat-head {
    grid-template-columns: 1fr;
  }

  .chat-clear-button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .chat-subtitle-row {
    grid-column: 1;
  }

  .chat-mode-switch {
    min-width: 124px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .node-modal-top {
    grid-template-columns: 1fr;
  }

  .node-modal-head-actions {
    flex-wrap: wrap;
  }

  .model-manager-grid {
    grid-template-columns: 1fr;
  }

  .ai-settings-grid {
    grid-template-columns: 1fr;
  }

  .ai-settings-input-grid {
    grid-template-columns: 1fr;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .donate-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .donate-copy-button {
    justify-self: start;
  }

  .wallet-status-row {
    grid-template-columns: 1fr 1fr;
  }

  .wallet-quick-button {
    height: 50px;
  }

  .wallet-form-grid {
    grid-template-columns: 1fr;
  }

  .wallet-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .wallet-inline-row {
    grid-template-columns: 1fr;
  }

  .wallet-inline-row button {
    width: 100%;
  }

  .wallet-history-table {
    min-width: 560px;
  }

  .chat-peer-controls {
    flex-direction: column;
  }
}

/* ─── Test Mode ──────────────────────────────────────────────────────────────── */

.wallet-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-testmode-card {
  border-color: #3a4a52;
}

.wallet-testmode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Toggle switch */
.wallet-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.wallet-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.wallet-toggle-track {
  display: flex;
  align-items: center;
  width: 36px;
  height: 20px;
  background: #2a3038;
  border-top: 1px solid var(--edge-dark);
  border-left: 1px solid var(--edge-dark);
  border-right: 1px solid var(--edge-light);
  border-bottom: 1px solid var(--edge-light);
  border-radius: 10px;
  transition: background 0.2s;
  padding: 2px;
}

.wallet-toggle-switch input:checked + .wallet-toggle-track {
  background: #3a5a6a;
  border-color: #4a8aaa;
}

.wallet-toggle-thumb {
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.wallet-toggle-switch input:checked + .wallet-toggle-track .wallet-toggle-thumb {
  transform: translateX(16px);
  background: #78d4f8;
}

.wallet-test-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: #2a1f0a;
  border-top: 1px solid #6b4c15;
  border-left: 1px solid #6b4c15;
  border-right: 1px solid #3a2800;
  border-bottom: 1px solid #3a2800;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8b84e;
  white-space: nowrap;
}

.wallet-test-badge-inline {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: #2a1f0a;
  border: 1px solid #6b4c15;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8b84e;
}

.wallet-faucet-card {
  border-color: #6b4c15;
  background: #1c1608;
}

.wallet-faucet-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-faucet-btn {
  background: #3a2800;
  color: #e8b84e;
  border-top: 1px solid #6b4c15;
  border-left: 1px solid #6b4c15;
  border-right: 1px solid #2a1c00;
  border-bottom: 1px solid #2a1c00;
}

.wallet-faucet-btn:hover:not(:disabled) {
  background: #4a3500;
}

.wallet-faucet-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

/* ─── Active swaps list ─────────────────────────────────────────────────────── */
.wallet-pending-list {
  display: grid;
  gap: 4px;
}

.wallet-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #1a1e24;
  border-top: 1px solid #3a4249;
  font-size: 9px;
}

.wallet-pending-label {
  color: #f2f8ff;
  font-weight: bold;
}

.wallet-pending-status {
  color: #e8b84e;
  text-transform: uppercase;
  font-size: 8px;
}

/* Device metadata — clickable status card */
.device-status-labels {
  flex: 1;
  min-width: 0;
}

/* Device metadata modal */
.device-meta-panel {
  width: min(320px, calc(100vw - 32px));
}

.device-meta-form {
  display: grid;
  gap: 12px;
  padding: 4px 0;
}

.device-meta-field {
  display: grid;
  gap: 4px;
}

.device-meta-label {
  font-size: 9px;
  font-family: "Press Start Local", monospace;
  color: var(--muted);
  text-transform: uppercase;
}

.device-meta-hint {
  font-size: 8px;
  opacity: 0.6;
  text-transform: none;
  font-family: inherit;
}

.device-meta-form input {
  width: 100%;
  box-sizing: border-box;
}

.device-meta-form button {
  width: 100%;
  margin-top: 4px;
}

.chat-channel-modal-panel {
  width: min(360px, calc(100vw - 32px));
}

.chat-channel-modal-form {
  display: grid;
  gap: 12px;
  padding: 4px 0;
}

.chat-channel-modal-form input {
  width: 100%;
  box-sizing: border-box;
}

.chat-channel-modal-form button {
  width: 100%;
  margin-top: 4px;
}

/* AI reply toggle row */
.ai-reply-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.ai-reply-row--settings {
  margin-left: 0;
  margin-bottom: 8px;
}

.ai-reply-label {
  font-size: 9px;
  font-family: "Press Start Local", monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-reply-btn {
  font-size: 9px;
  font-family: "Press Start Local", monospace;
  text-transform: uppercase;
  padding: 4px 10px;
  border-top: 2px solid var(--edge-light);
  border-left: 2px solid var(--edge-light);
  border-right: 2px solid var(--edge-dark);
  border-bottom: 2px solid var(--edge-dark);
  background: #1f2226;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s, background 0.15s;
}

.ai-reply-btn:hover {
  color: var(--ink);
}

.ai-reply-btn--on {
  background: #1a2e1a;
  color: #4caf50;
  border-top-color: var(--edge-dark);
  border-left-color: var(--edge-dark);
  border-right-color: var(--edge-light);
  border-bottom-color: var(--edge-light);
}

/* ── TAK / ATAK Panel ─────────────────────────────────────────────────────── */
.tak-panel {
  background: rgba(13, 16, 22, 0.96);
  border: 1px solid rgba(74, 158, 255, 0.22);
  border-radius: 0;
  color: #c8d8e8;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12px;
  min-width: 210px;
  max-width: 240px;
  max-height: 72vh;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(74,158,255,0.25) transparent;
}
.tak-panel.hidden {
  display: none;
}
.tak-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 6px;
  border-bottom: 1px solid rgba(74, 158, 255, 0.15);
}
.tak-panel-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4a9eff;
}
.tak-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: none;
  border: none;
  color: #8ea9c4;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.12s, color 0.12s;
}
.tak-panel-close:hover {
  opacity: 1;
  color: #d3e4f5;
}
@keyframes tak-spin-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.tak-section {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tak-section:last-child {
  border-bottom: none;
}
.tak-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6a8aa8;
  margin-bottom: 6px;
}
.tak-layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
}
.tak-layer-row:hover {
  background: rgba(74, 158, 255, 0.08);
}
.tak-layer-row.tak-layer-active {
  background: rgba(74, 158, 255, 0.14);
  outline: 1px solid rgba(74, 158, 255, 0.3);
}
.tak-layer-color {
  width: 10px;
  height: 10px;
  border-radius: 0;
  flex-shrink: 0;
}
.tak-layer-name {
  flex: 1;
  font-size: 11.5px;
  color: #c0d0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tak-layer-hidden {
  opacity: 0.38;
  text-decoration: line-through;
}
.tak-layer-vis {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  color: #c0d0e0;
  display: flex;
  align-items: center;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.tak-layer-vis:hover {
  opacity: 1;
}
.tak-layer-status,
.tak-layer-resend {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.12s, color 0.12s, transform 0.12s;
}
.tak-layer-status {
  opacity: 0.72;
  color: #6f859b;
}
.tak-layer-status--sending {
  color: #9eb8cf;
  animation: tak-spin-text 1.2s linear infinite;
}
.tak-layer-status--sent {
  color: #4caf50;
}
.tak-layer-status--unconfirmed {
  color: #ffb347;
}
.tak-layer-status--error {
  color: #ff6060;
}
.tak-layer-status:hover {
  opacity: 1;
}
.tak-layer-resend {
  opacity: 0.45;
  color: #8fb6ff;
}
.tak-layer-resend:hover {
  opacity: 1;
  transform: rotate(-20deg);
}
.tak-layer-delete {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.3;
  color: #ff6060;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
.tak-layer-delete:hover {
  opacity: 1;
}
.tak-item-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px 14px;
}
.tak-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 1px solid rgba(74, 158, 255, 0.18);
}
.tak-item-type {
  flex-shrink: 0;
  min-width: 44px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #6f93b7;
}
.tak-item-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: #c0d0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tak-item-delete {
  background: none;
  border: none;
  padding: 0;
  color: #ff6060;
  opacity: 0.42;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
.tak-item-delete:hover {
  opacity: 1;
}
.tak-mini-btn {
  background: rgba(74, 158, 255, 0.12);
  border: 1px solid rgba(74, 158, 255, 0.28);
  color: #4a9eff;
  border-radius: 0;
  padding: 1px 7px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
  line-height: 1.5;
}
.tak-mini-btn:hover {
  background: rgba(74, 158, 255, 0.22);
}
.tak-draw-toolbar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tak-draw-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b0c4d8;
  border-radius: 0;
  padding: 5px 9px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.tak-draw-btn:hover {
  background: rgba(74, 158, 255, 0.1);
  border-color: rgba(74, 158, 255, 0.28);
  color: #c8dff0;
}
.tak-draw-btn.tak-draw-btn--active {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.5);
  color: #4a9eff;
}
.tak-draw-hint {
  font-size: 10px;
  color: #6a8aa8;
  padding: 4px 2px 0;
  line-height: 1.5;
}
.tak-draw-hint.hidden {
  display: none;
}
.tak-draw-actions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}
.tak-draw-finish {
  flex: 1;
  background: rgba(74, 158, 255, 0.12);
  border: 1px solid rgba(74, 158, 255, 0.4);
  color: #4a9eff;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}
.tak-draw-finish:hover:not(:disabled) {
  background: rgba(74, 158, 255, 0.22);
}
.tak-draw-finish:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.tak-draw-finish.hidden {
  display: none;
}
.tak-draw-cancel {
  flex: 1;
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.28);
  color: #ff7070;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}
.tak-draw-cancel:hover {
  background: rgba(255, 80, 80, 0.18);
}
.tak-draw-cancel.hidden {
  display: none;
}
.tak-empty-hint {
  font-size: 11px;
  color: #4a6070;
  padding: 2px 0;
  font-style: italic;
}
/* TAK Inline Dialog */
.tak-panel {
  position: relative;
}
.tak-inline-dialog {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 20, 0.96);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  z-index: 20;
}
.tak-map-editor {
  position: absolute;
  min-width: 220px;
  max-width: 246px;
  background: rgba(10, 13, 20, 0.97);
  border: 1px solid rgba(74, 158, 255, 0.28);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  z-index: 1500;
}
.tak-map-editor.hidden {
  display: none;
}
.tak-map-editor--compact .tak-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tak-map-editor--compact .tak-form-field--wide {
  grid-column: 1 / -1;
}
.tak-map-editor--compact .tak-dialog-label {
  font-size: 10px;
}
.tak-map-editor--compact .tak-dialog-input,
.tak-map-editor--compact .tak-dialog-select,
.tak-map-editor--compact .tak-dialog-textarea {
  font-size: 11px;
  padding: 5px 7px;
}
.tak-map-editor--compact .tak-dialog-textarea {
  min-height: 54px;
}
.tak-map-editor--compact .tak-dialog-actions {
  gap: 4px;
}
.tak-map-editor--compact .tak-dialog-ok,
.tak-map-editor--compact .tak-dialog-cancel-btn {
  padding: 4px 8px;
  font-size: 11px;
}
.tak-inline-dialog.hidden {
  display: none;
}
.tak-dialog-label {
  font-size: 11px;
  color: #a0b8cc;
  font-weight: 600;
}
.tak-dialog-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(74, 158, 255, 0.35);
  border-radius: 5px;
  color: #e0eaf4;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.tak-dialog-input:focus {
  border-color: rgba(74, 158, 255, 0.7);
}
.tak-dialog-select,
.tak-dialog-textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(74, 158, 255, 0.35);
  border-radius: 5px;
  color: #e0eaf4;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.tak-dialog-select:focus,
.tak-dialog-textarea:focus {
  border-color: rgba(74, 158, 255, 0.7);
}
.tak-dialog-textarea {
  resize: vertical;
  min-height: 68px;
}
.tak-dialog-color {
  min-height: 34px;
  padding: 3px;
}
.tak-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tak-feature-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(74, 158, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
}
.tak-map-editor--compact .tak-feature-preview {
  padding: 6px 8px;
}
.tak-feature-preview-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #6a8aa8;
}
.tak-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tak-form-field span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #6a8aa8;
}
.tak-form-field--wide {
  grid-column: 1 / -1;
}
.tak-dialog-actions {
  display: flex;
  gap: 6px;
}
.tak-dialog-ok {
  flex: 1;
  background: rgba(74, 158, 255, 0.18);
  border: 1px solid rgba(74, 158, 255, 0.45);
  color: #4a9eff;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.tak-dialog-ok:hover {
  background: rgba(74, 158, 255, 0.3);
}
.tak-dialog-ok--danger {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff6060;
}
.tak-dialog-ok--danger:hover {
  background: rgba(255, 80, 80, 0.25);
}
.tak-dialog-cancel-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #7a9ab8;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.tak-dialog-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #a0b8cc;
}

/* Crosshair cursor while drawing */
.nodes-map-container.tak-drawing,
.nodes-map-container.tak-drawing .leaflet-container {
  cursor: crosshair !important;
}
/* TAK waypoint markers */
.tak-marker-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
  overflow: visible;
}
.tak-marker-symbol {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 5px rgba(0,0,0,0.6));
}
.tak-marker-symbol svg {
  width: 16px;
  height: 16px;
  display: block;
}
.tak-marker-label {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}
.tak-measure-label {
  position: relative;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 6px;
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid rgba(74, 158, 255, 0.24);
  color: #d8e6f2;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}
