/* ==========================================================================
   Rust+ Bot — app theme
   One modern layer shared by every page. Loads AFTER each template's own
   <style> block, so equivalent-specificity rules here win the cascade.
   Structure: tokens -> base -> layout -> components -> utilities -> motion.
   ========================================================================== */

:root {
  /* surfaces */
  --bg:            #0a0e17;
  --bg-2:          #0d1220;
  --surface:       #111826;
  --surface-2:     #151d2e;
  --surface-3:     #1a2436;
  --overlay:       rgba(6, 9, 15, .74);

  /* lines */
  --line:          #212b3d;
  --line-soft:     #1a2333;
  --line-strong:   #2b3a54;

  /* text */
  --text:          #e8ecf4;
  --text-2:        #b6c0d0;
  --muted:         #8b93a7;
  --muted-2:       #6f7a8e;

  /* brand + semantics */
  --accent:        #e2543a;
  --accent-hi:     #f2705a;
  --accent-dim:    rgba(226, 84, 58, .14);
  --violet:        #8b5cf6;
  --blue:          #60a5fa;
  --green:         #2ec27e;
  --green-soft:    #6ee7b7;
  --amber:         #fbbf24;
  --red:           #f87171;

  /* shape */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* elevation */
  --sh-1: 0 1px 2px rgba(0,0,0,.35);
  --sh-2: 0 6px 20px rgba(0,0,0,.35);
  --sh-3: 0 16px 44px rgba(0,0,0,.45);

  /* motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: .16s var(--ease);
  --med:  .28s var(--ease);

  /* type */
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo,
          Consolas, 'Courier New', monospace;
}

/* ── base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font) !important;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(226,84,58,.10), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(139,92,246,.08), transparent 55%),
    var(--bg) !important;
  color: var(--text) !important;
  line-height: 1.55;
  font-size: 15px;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-weight: 650;
  letter-spacing: -.021em;
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem); margin: 0 0 .55rem; }
h2 { font-size: clamp(1.2rem, 1rem + .8vw, 1.5rem); margin: 0 0 .5rem; }
h3 { font-size: 1.08rem; margin: 0 0 .4rem; }

p { margin: 0 0 .75rem; }

a {
  color: var(--accent-hi);
  text-decoration: none;
  transition: color var(--fast), opacity var(--fast);
}
a:hover { color: #fff; }

code, pre, kbd, samp, .mono, .cmd-name, .cmd-usage {
  font-family: var(--mono) !important;
  font-size: .86em;
}

pre, .cmd-usage {
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-sm) !important;
  padding: .7rem .85rem !important;
  overflow-x: auto;
}

::selection { background: rgba(226,84,58,.34); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: 6px;
}

/* thin, dark scrollbars */
* { scrollbar-width: thin; scrollbar-color: #2b3a54 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #26314a;
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #34425f; background-clip: content-box; }

/* ── layout ───────────────────────────────────────────────────────────── */

.wrap, .container, main, .page {
  max-width: 1240px;
  margin-inline: auto;
}

/* slim sticky header */
nav, .topbar, header.topbar, .site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(10, 14, 23, .82) !important;
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line) !important;
  box-shadow: var(--sh-1);
  padding: .7rem 1.5rem !important;
}

nav a, .topbar a { color: var(--text-2); }
nav a:hover, .topbar a:hover { color: #fff; }

.card, .panel, .box, .tile, .stat-box, .feat-card, .server-tab-panel, section.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2)) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r) !important;
  box-shadow: var(--sh-1);
  transition: border-color var(--fast), box-shadow var(--med), transform var(--med);
}
.card:hover, .feat-card:hover {
  border-color: #2c3a52 !important;
  box-shadow: var(--sh-2);
}
.feat-card:hover { transform: translateY(-3px); }

.card-title, .section-title, .mkt-section-title {
  font-weight: 640;
  letter-spacing: -.01em;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: .5rem;
  margin-bottom: .75rem;
}

/* ── buttons ──────────────────────────────────────────────────────────── */

.btn, button.btn, a.btn, input[type="submit"], button:not(.bare) {
  font-family: var(--font) !important;
}

.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .5rem 1rem !important;
  min-height: 38px;
  font-size: .855rem;
  font-weight: 600;
  letter-spacing: .002em;
  border: 1px solid transparent !important;
  border-radius: var(--r-sm) !important;
  cursor: pointer;
  white-space: nowrap;
  background: var(--surface-3) !important;
  color: var(--text) !important;
  transition: background var(--fast), border-color var(--fast),
              transform var(--fast), box-shadow var(--fast), filter var(--fast);
}
.btn:hover, button.btn:hover, a.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--sh-1);
  filter: none !important;
}
.btn:active, button.btn:active, a.btn:active { transform: translateY(0); }

.btn-primary, .btn-rust {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 6px 18px rgba(226,84,58,.22);
}
.btn-primary:hover, .btn-rust:hover { filter: brightness(1.06) !important; }

.btn-ghost, .btn-muted {
  background: rgba(255,255,255,.035) !important;
  border-color: var(--line) !important;
  color: var(--text-2) !important;
}
.btn-ghost:hover, .btn-muted:hover {
  background: rgba(255,255,255,.07) !important;
  border-color: #2c3a52 !important;
  color: #fff !important;
}

.btn-danger {
  background: rgba(248,113,113,.12) !important;
  border-color: rgba(248,113,113,.35) !important;
  color: var(--red) !important;
}
.btn-danger:hover { background: rgba(248,113,113,.2) !important; }

.btn-sm { padding: .3rem .7rem !important; min-height: 31px; font-size: .79rem; border-radius: 7px !important; }

button:disabled, .btn:disabled, .btn[disabled] {
  opacity: .5; cursor: not-allowed; transform: none !important;
}

/* ── forms ────────────────────────────────────────────────────────────── */

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="search"], input[type="url"],
input[type="datetime-local"], input[type="time"], input[type="date"],
textarea, select {
  font-family: var(--font) !important;
  font-size: .88rem;
  width: 100%;
  padding: .55rem .75rem;
  min-height: 38px;
  color: var(--text) !important;
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-sm) !important;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
textarea { min-height: 110px; line-height: 1.5; resize: vertical; }

input:hover, textarea:hover, select:hover { border-color: #2c3a52 !important; }

input:focus, textarea:focus, select:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  background: var(--surface) !important;
}

input::placeholder, textarea::placeholder { color: var(--muted-2) !important; }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem !important;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  min-height: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

label { color: var(--text-2); font-size: .86rem; }
.lbl, .form-row > label { color: var(--muted) !important; font-weight: 600; font-size: .78rem; letter-spacing: .02em; }

/* ── tables ───────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  font-size: .87rem;
}
th {
  text-align: left;
  font-weight: 620;
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted) !important;
  background: var(--bg-2) !important;
  border-bottom: 1px solid var(--line) !important;
  padding: .6rem .75rem !important;
  position: sticky;
  top: 0;
  z-index: 2;
}
td {
  padding: .58rem .75rem !important;
  border-bottom: 1px solid var(--line-soft) !important;
  color: var(--text-2);
}
tbody tr { transition: background var(--fast); }
tbody tr:hover td { background: rgba(255,255,255,.028); }
tbody tr:last-child td { border-bottom: none !important; }

.cmd-table td, table.mono td { font-family: var(--mono); font-size: .82rem; }

/* ── tabs ─────────────────────────────────────────────────────────────── */

.main-tab, .server-tab, .tab, .subtabs button, .ht-btn, .vt-btn {
  font-family: var(--font) !important;
  font-weight: 580;
  border-radius: var(--r-sm) !important;
  border: 1px solid transparent !important;
  padding: .42rem .85rem !important;
  cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
  background: transparent !important;
  color: var(--muted) !important;
}
.main-tab:hover, .server-tab:hover, .tab:hover, .ht-btn:hover, .vt-btn:hover {
  background: rgba(255,255,255,.05) !important;
  color: var(--text) !important;
}
.main-tab.active, .server-tab.active, .tab.active, .ht-btn.active, .vt-btn.active {
  background: var(--accent-dim) !important;
  border-color: rgba(226,84,58,.35) !important;
  color: #fff !important;
}

/* ── badges / pills / tags ────────────────────────────────────────────── */

.badge, .stat-pill, .demand-tag, .tag-travel, .pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: var(--r-pill) !important;
  font-size: .73rem;
  font-weight: 620;
  letter-spacing: .01em;
  border: 1px solid var(--line) !important;
  background: rgba(255,255,255,.04);
  color: var(--text-2);
}
.badge.green { background: rgba(46,194,126,.14) !important; color: var(--green-soft) !important; border-color: rgba(46,194,126,.34) !important; }
.badge.red, .badge.danger { background: rgba(248,113,113,.14) !important; color: #fca5a5 !important; border-color: rgba(248,113,113,.34) !important; }
.badge.amber, .badge.warn { background: rgba(251,191,36,.14) !important; color: var(--amber) !important; border-color: rgba(251,191,36,.32) !important; }
.badge.blue { background: rgba(96,165,250,.14) !important; color: #93c5fd !important; border-color: rgba(96,165,250,.32) !important; }

.dot { box-shadow: 0 0 0 3px rgba(255,255,255,.05); }

/* ── states ───────────────────────────────────────────────────────────── */

.empty-state, .empty-big { color: var(--muted) !important; }
.empty-state {
  border: 1px dashed var(--line) !important;
  border-radius: var(--r) !important;
  background: rgba(255,255,255,.015) !important;
  padding: 1.1rem !important;
}
.empty-big { font-size: 1.6rem !important; opacity: .5; }

.hint, .dim, .cmd-desc, .muted { color: var(--muted) !important; }

.alert-bar, .banner, .notice, .flash {
  border-radius: var(--r-sm) !important;
  border: 1px solid var(--line) !important;
  background: var(--surface-2) !important;
  padding: .6rem .8rem !important;
}

/* ── overlays / toasts ────────────────────────────────────────────────── */

.overlay, .modal, .modal-bg, .modal-backdrop { background: var(--overlay) !important; backdrop-filter: blur(4px); }
.overlay-inner, .modal-card, .modal-box, .modal-content {
  background: linear-gradient(180deg, var(--surface), var(--surface-2)) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--sh-3) !important;
}
.toast {
  background: var(--surface-2) !important;
  border: 1px solid var(--line) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: var(--r-sm) !important;
  box-shadow: var(--sh-2);
  color: var(--text) !important;
}

/* ── utilities ────────────────────────────────────────────────────────── */

.green { color: var(--green-soft) !important; }
.right { text-align: right; }
.num, .val { font-variant-numeric: tabular-nums; }
.hr, hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

/* description lists / key-value rows used on several pages */
.kv, .row { border-color: var(--line-soft); }

/* ── motion ───────────────────────────────────────────────────────────── */

@keyframes rpb-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.card, .feat-card, .stat-box, .server-tab-panel, .empty-state, .panel, section.card {
  animation: rpb-rise .34s var(--ease) both;
}

@keyframes rpb-fade { from { opacity: 0 } to { opacity: 1 } }
.overlay, .modal, .toast { animation: rpb-fade .18s var(--ease) both; }

.spin { animation: rpb-spin .9s linear infinite; }
@keyframes rpb-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── responsive ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  body { font-size: 14.5px; }
  nav, .topbar, .site-header { padding: .6rem .9rem !important; }
  .card, .panel, .tile { border-radius: var(--r-sm) !important; }
}

/* the header row (.topbar h1 + .right nav) is flex/nowrap in the templates and
   blows past the viewport on phones — let it wrap and drop the long session id */
@media (max-width: 780px) {
  body { overflow-x: hidden; }
  .topbar, header, nav, .site-header {
    flex-wrap: wrap !important;
    row-gap: .55rem;
    align-items: flex-start !important;
  }
  .topbar .right, .right {
    flex-wrap: wrap !important;
    width: 100%;
    justify-content: flex-start !important;
    gap: .45rem !important;
  }
  .topbar .right > span:first-child, .topbar .right > .mono:first-child { display: none; }
  .topbar h1 { font-size: 1.05rem !important; }
  .wrap, .container, main, .page { max-width: 100%; }
  img, canvas, svg, video { max-width: 100%; height: auto; }
  /* let wide tables scroll inside their card instead of stretching the page */
  .card, .panel, .tile, .server-tab-panel, section.card { overflow-x: auto; }
  table { max-width: 100%; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .btn { padding: .5rem .8rem !important; }
  th, td { padding: .5rem .55rem !important; }
  table { font-size: .84rem; }
}

/* ── glyph replacements ───────────────────────────────────────────────── */
/* sort-direction triangles drawn in CSS (replaced arrow glyphs in tables) */
.si {
  display: inline-block;
  width: 0; height: 0;
  margin-left: .28rem;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.si.up { border-bottom: 5px solid var(--text-2); }
.si.dn { border-top: 5px solid var(--text-2); }
.si.ne { border-bottom: 3px solid transparent; border-top: 3px solid transparent; border-left-color: var(--muted-2); }

/* icon slots that held a removed glyph */
.search-ico { display: none !important; }
.search-wrap input { padding-left: .75rem !important; }
.al-perm-icon:empty { display: none; }
.empty-big:empty, .empty-icon:empty { display: none; }

/* floating feedback button: was a 48px circle holding a glyph, now a labelled pill */
#fb-float {
  width: auto !important;
  height: auto !important;
  padding: .58rem 1.05rem !important;
  border-radius: var(--r-pill) !important;
  font-size: .82rem !important;
  font-weight: 620;
  font-family: var(--font) !important;
  letter-spacing: .01em;
  min-height: 40px;
}
#fb-float:empty::after { content: "Feedback"; }

/* shop browser: Rust+ platform-change notice */
.platform-notice {
  margin: .65rem 0 .1rem;
  padding: .8rem 1rem;
  background: rgba(226, 84, 58, .08);
  border: 1px solid rgba(226, 84, 58, .3);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: .84rem;
  line-height: 1.5;
}
.platform-notice strong { color: var(--text); }
@media (min-width: 641px) {
  body.pn-on #panel-browse { height: calc(100vh - 252px); }
}

/* admin: sign-in IP list */
.ip-hist { display: flex; flex-direction: column; gap: .4rem; }
.ip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
  padding: .45rem .65rem;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.ip-addr { color: var(--green-soft); font-size: .85rem; }

.chat-send-status { font-size: .74rem; color: var(--muted-2); white-space: nowrap; }
.chat-send-status.ok { color: var(--green-soft); }
.chat-send-status.err { color: var(--red); }
.chat-send-status.pending { color: var(--muted); }

/* send-to-team-chat row (per-server panel + per-server page) */
.chat-send { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.chat-send input[type=text] {
  flex: 1; min-width: 140px; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: .42rem .7rem; border-radius: var(--r-sm); font-size: .86rem;
}
.chat-send input[type=text]:focus { outline: none; border-color: var(--accent); }
.chat-send-hint { margin: 0 0 .7rem; font-size: .72rem; color: var(--muted-2); }

/* live status strip (dashboard / panel / per-server page) */
.status-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .6rem .85rem;
  margin-bottom: 1rem;
}
.ss-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.3rem; }
.ss-item { display: inline-flex; align-items: baseline; gap: .4rem; }
.ss-k { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); }
.ss-v { font-size: .86rem; color: var(--text); font-weight: 600; }
.ss-right { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; }
.ss-dot {
  width: 8px; height: 8px; border-radius: 50%; align-self: center;
  background: var(--red); box-shadow: 0 0 0 3px rgba(248, 113, 113, .15);
}
.ss-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(46, 194, 126, .16); }
.ss-sub { font-size: .74rem; color: var(--muted-2); margin-top: .45rem; }
@media (max-width: 700px) { .ss-right { margin-left: 0; } }

/* print */
@media print {
  body { background: #fff !important; color: #000 !important; }
  nav, .topbar, .btn { display: none !important; }
}

/* ── Chat tab: toolbar, scrolling log, composer pinned at the bottom ── */
.chat-shell { display: flex; flex-direction: column; height: min(60vh, 560px); min-height: 340px; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  flex-wrap: wrap; padding-bottom: .5rem; border-bottom: 1px solid var(--line-soft); }
.chat-toolbar .chat-controls { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.chat-toolbar .chat-controls input, .chat-toolbar .chat-controls select {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: .35rem .5rem; font-size: .8rem; }
.chat-toolbar .chat-controls input { min-width: 170px; }
.chat-meta { font-size: .72rem; color: var(--muted-2); white-space: nowrap; }
.chat-bubbles { flex: 1 1 auto; overflow-y: auto; padding: .7rem .2rem; display: flex;
  flex-direction: column; gap: .45rem; scrollbar-width: thin; }
.chat-bubbles .bubble { margin: 0; }
.chat-empty { color: var(--muted-2); font-size: .82rem; }
/* Day dividers in the chat log ("TODAY" / "YESTERDAY" / "WEDNESDAY, SEP 24"): the
   label sits between two hairlines so a long log stays scannable by date. */
.chat-bubbles .chat-day { display: flex; align-items: center; gap: .6rem; margin: .6rem 0 .15rem;
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); }
.chat-bubbles .chat-day::before, .chat-bubbles .chat-day::after { content: ""; flex: 1 1 auto;
  height: 1px; background: var(--line-soft); }
/* ── Map sharing: a shared map that was pulled stops claiming to be live ───── */
.live-badge.stopped { color: var(--red); }
.live-badge.stopped .live-dot { background: var(--red); animation: none; box-shadow: none; }

/* ── Map sharing: the Share popover on /map/<idx> ────────────────────────────
   Owner-only control that mints a read-only link friends can open without an
   account (`/map/share/<code>`). Guests get `.share-pill` instead of the button,
   so nothing here is ever rendered on a shared view. */
.share-pill {
  font-size: .68rem; font-weight: 600; letter-spacing: .02em; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  padding: .18rem .55rem; white-space: nowrap;
}
.share-open {
  font: inherit; font-size: .74rem; font-weight: 600; cursor: pointer;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: .22rem .6rem; transition: background var(--fast), border-color var(--fast);
}
.share-open:hover { background: var(--surface-3); border-color: var(--accent); }
.share-open.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hi); }

.share-pop { position: absolute; top: 46px; right: .75rem; z-index: 40; }
.share-card {
  width: min(24rem, calc(100vw - 1.5rem));
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: .8rem .85rem .85rem;
}
.share-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.share-title { font-size: .78rem; font-weight: 650; color: var(--text); }
.share-x {
  font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; color: var(--muted-2);
  background: none; border: 0; padding: 0 .15rem; border-radius: 4px;
}
.share-x:hover { color: var(--text); }
.share-note {
  font-size: .72rem; color: var(--green-soft); background: rgba(46,194,126,.1);
  border: 1px solid rgba(46,194,126,.3); border-radius: var(--r-sm);
  padding: .35rem .5rem; margin-bottom: .55rem;
}
.share-hint { font-size: .72rem; line-height: 1.5; color: var(--muted); margin: 0 0 .6rem; }
.share-row { display: flex; gap: .35rem; }
.share-url {
  flex: 1; min-width: 0; font: inherit; font-size: .72rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-2); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .35rem .45rem;
}
.share-url:focus { outline: none; border-color: var(--accent); }
.share-copy {
  font: inherit; font-size: .72rem; font-weight: 650; cursor: pointer; white-space: nowrap;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: .35rem .6rem;
}
.share-copy:hover { border-color: var(--accent); }
.share-copy.done { color: var(--green-soft); border-color: rgba(46,194,126,.45); background: rgba(46,194,126,.12); }
.share-stats { font-size: .7rem; color: var(--muted-2); margin: .5rem 0 0; }
.share-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.share-actions form { margin: 0; }
.share-btn {
  font: inherit; font-size: .73rem; font-weight: 600; cursor: pointer;
  border-radius: var(--r-sm); padding: .32rem .62rem; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); transition: background var(--fast), border-color var(--fast);
}
.share-btn:hover { background: var(--surface-3); }
.share-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.share-btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.share-btn.stop { color: var(--red); border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.1); }
.share-btn.stop:hover { background: rgba(248,113,113,.18); }
.share-btn.ghost { color: var(--muted); }
.share-btn.ghost:hover { color: var(--text); }

.chat-bubbles .bub-meta { white-space: nowrap; display: flex; align-items: baseline; gap: .4rem; }
.chat-bubbles .bubble.bot .bub-meta { justify-content: flex-end; }
.chat-bubbles .bub-when { color: var(--muted); font-size: .66rem; font-weight: 500;
  white-space: nowrap; cursor: help; }
.chat-bubbles .bub-when::before { content: "·"; margin-right: .35rem; color: var(--muted-2); }
.chat-send { display: flex; align-items: center; gap: .5rem; padding-top: .6rem;
  border-top: 1px solid var(--line-soft); }
.chat-send input[name=message] { flex: 1 1 auto; min-width: 0; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); border-radius: var(--r-pill);
  padding: .6rem .9rem; font-size: .88rem; }
.chat-send input[name=message]:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim); }
.chat-send .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
  .chat-shell { height: min(66vh, 520px); }
  .chat-toolbar .chat-controls input { min-width: 120px; }
}

/* The panel's global form rules give inputs/selects width:100%, which wrapped each
   chat toolbar control onto its own row; size them explicitly so the bar is one line. */
.chat-toolbar { flex-wrap: nowrap; }
.chat-toolbar .chat-controls { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
.chat-toolbar .chat-controls input { flex: 0 1 200px; width: auto; max-width: 200px; min-width: 130px; }
.chat-toolbar .chat-controls select { flex: 0 0 auto; width: auto; }
.chat-toolbar .chat-controls .btn { flex: 0 0 auto; width: auto; }
.chat-meta { margin-left: auto; }
.chat-shell { height: min(64vh, 620px); }
@media (max-width: 640px) {
  .chat-toolbar { flex-wrap: wrap; }
  .chat-toolbar .chat-controls { flex-wrap: wrap; }
  .chat-toolbar .chat-controls input { flex: 1 1 100%; max-width: none; }
  .chat-meta { margin-left: 0; }
}

/* ── Settings: toggle switches + event-alert cards ─────────────────────────
   One switch look for the per-server Settings tab (panel + per-server page)
   and the admin forms.  A plain checkbox drives it through :checked, so it
   works without JS and stays keyboard/AT accessible; the .tgl-state word next
   to it is the friendly status and is kept in sync by _panel_js.html. */
.settings-form .toggle-wrap { display: inline-flex; align-items: center; gap: .5rem; }
.settings-form .toggle { position: relative; display: inline-block; flex: 0 0 46px;
  width: 46px; height: 26px; margin: 0; cursor: pointer; }
.settings-form .toggle input { position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; }
.settings-form .toggle .slider { position: absolute; inset: 0; background: var(--surface-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); pointer-events: none;
  transition: background var(--fast), border-color var(--fast); }
.settings-form .toggle .slider::before { content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--muted);
  transition: transform var(--fast), background var(--fast); }
.settings-form .toggle:hover .slider { border-color: #3d4c6b; }
.settings-form .toggle input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.settings-form .toggle input:checked + .slider::before { transform: translateX(20px); background: #fff; }
.settings-form .toggle input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-dim); }
.tgl-state { font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted-2); min-width: 1.9rem; }
.tgl-state.on { color: var(--green-soft); }

.settings-form .alerts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: .65rem; margin-top: .55rem; }
.settings-form .alert-item { background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .6rem .8rem .55rem; display: flex;
  flex-direction: column; gap: .5rem; transition: border-color var(--fast); }
.settings-form .alert-item.on { border-color: rgba(226, 84, 58, .38); }
.settings-form .alert-head { display: flex; align-items: center; gap: .55rem; }
.settings-form .alert-head .alert-name { flex: 1 1 auto; font-size: .86rem; font-weight: 600; color: var(--text); }
.settings-form .alert-lead { display: flex; align-items: center; gap: .45rem; font-size: .76rem; color: var(--muted); }
.settings-form .alert-lead .lead-label { color: var(--text-2); }
.settings-form .alert-lead input { flex: 0 0 auto; width: 58px; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--text); border-radius: var(--r-sm);
  padding: .28rem .45rem; font-size: .8rem; }
.settings-form .alert-lead input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim); }
.settings-form .alert-item:not(.on) .alert-name { color: var(--text-2); }
.settings-form .alert-item:not(.on) .alert-lead { opacity: .55; }
@media (max-width: 640px) {
  .settings-form .alerts-grid { grid-template-columns: 1fr; }
}

/* admin forms: same switch for .toggle-switch checkboxes (the markup is a bare
   checkbox + label word, so the whole look lives on the input itself) */
.toggle-switch input[type=checkbox] { -webkit-appearance: none; appearance: none;
  position: relative; flex: 0 0 46px; width: 46px; height: 26px; margin: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface-3); cursor: pointer;
  transition: background var(--fast), border-color var(--fast); }
.toggle-switch input[type=checkbox]::before { content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--muted);
  transition: transform var(--fast), background var(--fast); }
.toggle-switch:hover input[type=checkbox] { border-color: #3d4c6b; }
.toggle-switch input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.toggle-switch input[type=checkbox]:checked::before { transform: translateX(20px); background: #fff; }
.toggle-switch input[type=checkbox]:focus-visible { outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim); }
