/* Mesh - dark, Discord-inspired layout */

:root {
  --bg-0: #1e1f22;
  --bg-1: #2b2d31;
  --bg-2: #313338;
  --bg-3: #383a40;
  --bg-hover: #35373c;
  --bg-active: #404249;
  --text: #f2f3f5;
  --text-2: #b5bac1;
  --text-3: #949ba4;
  --border: #1f2023;
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --green: #23a55a;
  --red: #da373c;
  --amber: #f0b232;
  --radius: 8px;
  --radius-lg: 14px;
  --rail-w: 72px;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.strong { font-weight: 600; }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mt { margin-top: 14px; }
hr { border: none; border-top: 1px solid var(--bg-3); margin: 18px 0; }

/* ------------------------------------------------------------------ shared */

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bg-0);
  border-radius: var(--radius);
  background: var(--bg-0);
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; }
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--text-2); margin: 14px 0 6px; }
.hint { font-size: 12px; color: var(--text-3); margin: 8px 0 0; }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--bg-3);
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--bg-active); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-success { background: var(--green); }
.btn-danger { background: var(--red); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--bg-3); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-block { width: 100%; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 6px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.danger:hover { background: var(--red); color: #fff; }
.icon-btn svg {
  display: block;
  pointer-events: none;
  stroke-width: 2;
}

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

.notice {
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  background: rgba(218, 55, 60, .15);
  border: 1px solid rgba(218, 55, 60, .45);
  color: #ffb3b5;
}
.notice.ok { background: rgba(35, 165, 90, .15); border-color: rgba(35,165,90,.45); color: #7ee2a8; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.dot.online { background: var(--green); }
.dot.offline { background: #747f8d; }
.dot.error { background: var(--red); }
.dot.live { background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  text-transform: uppercase;
  user-select: none;
}
.avatar.sm { width: 28px; height: 28px; flex-basis: 28px; font-size: 12px; }

/* -------------------------------------------------------------------- auth */

.auth-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #3a3d7a 0%, var(--bg-0) 60%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.auth-brand h1 { margin: 0; font-size: 24px; }
.auth-brand p { margin: 2px 0 0; font-size: 13px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
}
.auth-tabs { display: flex; gap: 6px; background: var(--bg-0); padding: 4px; border-radius: var(--radius); }
.auth-tab {
  flex: 1; border: none; background: transparent; color: var(--text-2);
  padding: 9px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer;
}
.auth-tab.active { background: var(--bg-3); color: var(--text); }
.auth-foot { margin: 14px 0 0; display: flex; justify-content: space-between; gap: 10px; }

.auth-transfer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-3);
}
.auth-transfer-row { display: flex; justify-content: space-between; gap: 10px; }
.auth-transfer .hint { margin-top: 6px; }
.auth-transfer textarea { font-size: 12px; }
#confirmHint { margin-top: 6px; font-size: 12px; }


/* ------------------------------------------------------------------ shell */

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-w) var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* rail */
.rail {
  background: var(--bg-0);
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rail-btn {
  position: relative;
  width: 48px; height: 48px;
  border: none; border-radius: 16px;
  background: var(--bg-2); color: var(--text-2);
  font-size: 18px; font-weight: 700;
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-radius .15s, background .15s, color .15s;
}
.rail-btn:hover { background: var(--brand); color: #fff; border-radius: 14px; }
.rail-btn.active { background: var(--brand); color: #fff; border-radius: 14px; }
.rail-btn.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 32px; border-radius: 0 4px 4px 0; background: #fff;
}
.rail-groups { display: flex; flex-direction: column; gap: 8px; }
.rail-add { color: var(--green); font-size: 22px; }
.rail-sep { width: 32px; height: 2px; background: var(--bg-3); border-radius: 1px; margin: 4px 0; }
.rail-badge {
  position: absolute; right: -2px; bottom: -2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border: 3px solid var(--bg-0);
}

/* sidebar */
.sidebar {
  background: var(--bg-1);
  display: flex; flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}
.sidebar-head { padding: 12px; border-bottom: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip-text { min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-id { font-size: 11px; color: var(--text-3); }
.relay-line { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12px; color: var(--text-3); }

.sidebar-search { padding: 10px 12px 6px; }
.sidebar-search input { padding: 7px 10px; font-size: 13px; }

.sidebar-section { padding: 6px 8px; min-height: 0; display: flex; flex-direction: column; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px 4px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--text-3); text-transform: uppercase;
}
.thread-list { overflow-y: auto; min-height: 40px; overscroll-behavior: contain; }
.thread-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 6px; cursor: pointer;
  color: var(--text-2);
  min-height: 44px;
}
.thread-item:hover { background: var(--bg-hover); }
.thread-item.active { background: var(--bg-active); color: var(--text); }
.thread-item .avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; }
.thread-item-main { min-width: 0; flex: 1; }
.thread-item-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item-preview { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item.unread .thread-item-name { color: #fff; }
.unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.online-ring { position: relative; }
.online-ring::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #747f8d; border: 2px solid var(--bg-1);
}
.online-ring.is-online::after { background: var(--green); }

.sidebar-foot { margin-top: auto; padding: 10px; display: grid; gap: 6px; border-top: 1px solid var(--border); }
.sidebar-foot .btn { padding: 8px; font-size: 13px; }

/* main */
.main { background: var(--bg-2); display: flex; min-width: 0; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.welcome { margin: auto; max-width: 540px; padding: 32px; }
.welcome h2 { margin-top: 0; }
.steps { color: var(--text-2); padding-left: 20px; }
.steps li { margin: 8px 0; }

.thread-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.thread-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thread-actions { display: flex; gap: 4px; }

.thread-body { flex: 1; display: flex; min-height: 0; }
.messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
  overscroll-behavior: contain;
}
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 13px; }
.msg-body { min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-author { font-weight: 600; font-size: 14px; }
.msg-time { font-size: 11px; color: var(--text-3); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.msg.system { justify-content: center; }
.msg.system .msg-body { text-align: center; color: var(--text-3); font-size: 13px; }
.msg.outgoing .msg-author { color: #b9c1ff; }

.composer {
  flex: 0 0 auto;
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.composer input { flex: 1; }

/* call panel */
.call-panel {
  width: 380px; flex: 0 0 380px;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-1);
  padding: 12px;
  gap: 12px;
  position: relative;
}
.call-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}
.video-wrap {
  position: relative;
  flex: 1;
  background: #141518;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 240px;
  display: flex;
  box-shadow: inset 0 0 0 1px var(--border);
}
.video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.video.local {
  position: absolute; right: 10px; bottom: 10px;
  width: 110px; height: 80px;
  border-radius: 8px; object-fit: cover;
  border: 2px solid rgba(255,255,255,.15);
  background: #111;
  z-index: 5;
}
.video-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 13px;
  background: radial-gradient(circle at center, #23272e 0%, #15171c 100%);
}
.call-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.call-avatar {
  width: 76px;
  height: 76px;
  flex-basis: 76px;
  font-size: 30px;
  font-weight: 600;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 3px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-avatar 3s infinite ease-in-out;
}
@keyframes pulse-avatar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.call-participant-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.call-participant-status {
  font-size: 12px;
  color: var(--text-3);
}
.call-meta { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; font-size: 12px; background: rgba(0,0,0,.55); padding: 4px 8px; border-radius: 999px; z-index: 6; }
.call-controls { display: flex; gap: 10px; justify-content: center; align-items: center; padding-top: 4px; }
.call-controls .icon-btn {
  background: var(--bg-3);
  color: var(--text);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  transition: all .15s ease;
}
.call-controls .icon-btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.call-controls .icon-btn.active { background: var(--brand); color: #fff; }
.call-controls .icon-btn.danger { background: var(--red); color: #fff; }
.call-controls .icon-btn.danger:hover { background: #d6393c; }

/* incoming call */
.incoming-call {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-lg);
  padding: 14px;
  width: 320px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  animation: slidein .2s ease;
}
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.incoming-body { display: flex; gap: 12px; align-items: center; }
.incoming-actions { display: flex; gap: 8px; margin-top: 12px; }
.incoming-actions .btn { flex: 1; }

/* modals */
.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.7);
  display: none; place-items: center;
  padding: 20px;
}
.modal-overlay.open { display: grid; }
.modal {
  width: 100%; max-width: 520px;
  max-height: 86vh;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px; overflow-y: auto; overscroll-behavior: contain; }

.invite-preview {
  display: flex; gap: 12px; align-items: center;
  margin-top: 14px; padding: 12px;
  background: var(--bg-1); border-radius: var(--radius);
}
.request-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.request-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--bg-1); border-radius: var(--radius);
}
.request-item .avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; }
.request-item-main { flex: 1; min-width: 0; }
.request-item-actions { display: flex; gap: 6px; }
.request-item-actions .btn { padding: 6px 10px; font-size: 13px; }

.member-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.member-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; }
.member-item:hover { background: var(--bg-hover); }
.member-item input { width: auto; }
.member-item .avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 12px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.kv span:first-child { color: var(--text-3); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-0); color: var(--text);
  padding: 12px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 90; font-size: 14px;
  max-width: 90vw;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 39;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.sidebar-backdrop.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.welcome-head {
  display: none;
}

.sidebar-toggle {
  display: none;
  font-size: 20px;
  margin-right: 4px;
}

/* responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: var(--rail-w) 1fr; }
  .welcome-head { display: flex; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: var(--rail-w);
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 40;
    transform: translateX(-110%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }
  .sidebar.open { transform: none; }
  .call-panel { position: fixed; inset: 0; width: auto; z-index: 50; }
}

@media (max-width: 600px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .rail {
    display: none;
  }
  .sidebar {
    left: 0;
    width: min(320px, 85vw);
  }
  .thread-head {
    padding: 10px 12px;
  }
  .messages {
    padding: 12px;
  }
  .composer {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .call-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-0);
  }
  .call-close-btn {
    display: inline-flex;
    top: calc(16px + env(safe-area-inset-top, 0px));
  }
  .video-wrap {
    flex: 1;
    min-height: 0;
  }
  .call-controls {
    flex: 0 0 auto;
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* Settings: relay rows + account switches */
.relay-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.relay-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-1); border-radius: var(--radius); cursor: pointer; }
.relay-item.enabled { background: var(--bg-3); }
.relay-checkbox { width: auto; }
.relay-info { flex: 1; min-width: 0; }
.relay-name { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.relay-url { font-size: 11px; color: var(--text-3); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relay-kind { font-size: 10px; font-weight: 700; color: var(--text-3); border: 1px solid var(--bg-active); border-radius: 4px; padding: 0 4px; }
.relay-badge { font-size: 9px; font-weight: 700; letter-spacing: .04em; background: var(--brand); color: #fff; border-radius: 3px; padding: 1px 4px; }
.relay-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); min-width: 96px; justify-content: flex-end; white-space: nowrap; }
.relay-status[data-status="online"] { color: var(--green); }
.relay-status[data-status="error"] { color: var(--red); }
.switch-row { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 14px; color: var(--text); cursor: pointer; margin: 0; }
.switch-row input { width: auto; }
.mt-input { margin-top: 8px; }
#settingsTabs { margin-bottom: 14px; }

/* Settings: sidebar layout (Discord-style) */
.settings-modal {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 820px;
  height: 78vh;
  max-height: 620px;
  padding: 0;
  overflow: hidden;
}
.settings-nav {
  width: 210px;
  flex: 0 0 210px;
  background: var(--bg-1);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
}
.settings-nav-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 0 10px 10px; }
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; color: var(--text-2);
  padding: 9px 10px; border-radius: 6px;
  min-height: 44px;
  box-sizing: border-box;
  font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: left;
}
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.settings-nav-item.active { background: var(--bg-active); color: var(--text); }
.settings-nav-icon { font-size: 13px; width: 16px; text-align: center; color: var(--text-3); }

.settings-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.settings-head h3 { margin: 0; font-size: 17px; }
.settings-scroll { padding: 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.settings-panel { display: flex; flex-direction: column; gap: 14px; }

.settings-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.settings-card.column { flex-direction: column; align-items: stretch; gap: 10px; }
.settings-card-main { flex: 1; min-width: 0; }
.settings-card-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-card label { margin-top: 0; }
.settings-card input { margin-bottom: 4px; }
.danger-text { color: #ff8f91; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--bg-active); position: relative; transition: background .15s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }

@media (max-width: 720px) {
  .settings-modal { flex-direction: column; height: 88vh; }
  .settings-nav { width: auto; flex: 0 0 auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .settings-nav-title { display: none; }
}

/* Relay row: disabled state + per-row test button */
.relay-status[data-status="off"] { color: var(--text-3); }
.dot.off { background: #4e5058; }
.relay-test {
  border: 1px solid var(--bg-active);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.relay-test:hover { background: var(--bg-active); color: var(--text); }

/* Invite preview presence line */
.presence-line { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.presence-line .dot { width: 8px; height: 8px; }

/* Add-friend dialog (link-only) */
.invite-preview-main { min-width: 0; }
.invite-empty { padding: 18px 4px; text-align: center; }
#relaySwitch { margin-top: 12px; }
#relaySwitch .row { margin-top: 8px; }

/* Invite expiry countdown */
.expiry-line { margin-top: 6px; font-variant-numeric: tabular-nums; }
.expiry-line[data-state="ok"] { color: var(--text-3); }
.expiry-line[data-state="soon"] { color: var(--amber); }
.expiry-line[data-state="expiring"] { color: var(--red); font-weight: 600; }
.expiry-line[data-state="expired"] { color: var(--red); font-weight: 600; }
