@font-face {
  font-family: Geist;
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Light is the base; dark follows the system unless the founder picks one. */
:root {
  color-scheme: light;
  --bg: #f7f7f6;
  --surface: #ffffff;
  --raised: #ffffff;
  --hover: rgba(15, 15, 20, 0.035);
  --selected: rgba(15, 15, 20, 0.055);
  --line: rgba(15, 15, 20, 0.07);
  --line-strong: rgba(15, 15, 20, 0.11);
  --text: #111113;
  --text-2: #3d3d42;
  --muted: #6f6f77;
  --faint: #a3a3aa;
  --gold: #a8822a;
  --gold-soft: rgba(176, 137, 46, 0.12);
  --self: #111113;
  --self-ink: #f7f7f6;
  --bubble: #ffffff;
  --kbd: rgba(15, 15, 20, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 15, 20, 0.05);
  --shadow-md: 0 1px 2px rgba(15, 15, 20, 0.04), 0 4px 16px rgba(15, 15, 20, 0.06);
  --shadow-lg: 0 0 0 1px rgba(15, 15, 20, 0.06), 0 8px 24px rgba(15, 15, 20, 0.08), 0 32px 64px rgba(15, 15, 20, 0.12);
  --scrim: rgba(247, 247, 246, 0.4);
  --c-gold: #a8822a;
  --c-blue: #3f7fd1;
  --c-rose: #d2553f;
  --c-amber: #c9952a;
  --c-violet: #7a5cd6;
  --c-slate: #6f7785;
  --c-ok: #2f9e62;
  --c-warn: #c27a12;
  --c-stop: #d2453a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0c;
    --surface: #0f0f11;
    --raised: #161618;
    --hover: rgba(255, 255, 255, 0.03);
    --selected: rgba(255, 255, 255, 0.055);
    --line: rgba(255, 255, 255, 0.06);
    --line-strong: rgba(255, 255, 255, 0.1);
    --text: #ededef;
    --text-2: #c8c8cd;
    --muted: #8d8d95;
    --faint: #5c5c63;
    --gold: #d8b765;
    --gold-soft: rgba(216, 183, 101, 0.12);
    --self: #ededef;
    --self-ink: #0b0b0c;
    --bubble: #18181b;
    --kbd: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 16px 40px rgba(0, 0, 0, 0.5), 0 40px 80px rgba(0, 0, 0, 0.45);
    --scrim: rgba(11, 11, 12, 0.6);
    --c-gold: #d8b765;
    --c-blue: #6fa6ec;
    --c-rose: #ec7a65;
    --c-amber: #e2b55a;
    --c-violet: #a58ff0;
    --c-slate: #9aa2b0;
    --c-ok: #4cc283;
    --c-warn: #e3a04a;
    --c-stop: #ef6a5f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #0f0f11;
  --raised: #161618;
  --hover: rgba(255, 255, 255, 0.03);
  --selected: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.1);
  --text: #ededef;
  --text-2: #c8c8cd;
  --muted: #8d8d95;
  --faint: #5c5c63;
  --gold: #d8b765;
  --gold-soft: rgba(216, 183, 101, 0.12);
  --self: #ededef;
  --self-ink: #0b0b0c;
  --bubble: #18181b;
  --kbd: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 16px 40px rgba(0, 0, 0, 0.5), 0 40px 80px rgba(0, 0, 0, 0.45);
  --scrim: rgba(11, 11, 12, 0.6);
  --c-gold: #d8b765;
  --c-blue: #6fa6ec;
  --c-rose: #ec7a65;
  --c-amber: #e2b55a;
  --c-violet: #a58ff0;
  --c-slate: #9aa2b0;
  --c-ok: #4cc283;
  --c-warn: #e3a04a;
  --c-stop: #ef6a5f;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1.45 Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.003em;
}
#app {
  height: 100%;
}
.mono {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
button:disabled {
  cursor: not-allowed;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
a {
  color: inherit;
}
svg.i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
kbd {
  font: 500 10.5px/1 "Geist Mono", ui-monospace, monospace;
  background: var(--kbd);
  color: var(--muted);
  border-radius: 4px;
  padding: 3px 5px;
  min-width: 18px;
  text-align: center;
  display: inline-block;
}
@media (prefers-reduced-motion: no-preference) {
  .row,
  .nav,
  .icon-btn,
  .chip,
  .act-btn,
  .btn {
    transition:
      background-color 0.12s ease,
      color 0.12s ease,
      opacity 0.12s ease;
  }
}

.app {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 300px;
  height: 100%;
  padding: 8px 8px 8px 0;
}
.app.no-side {
  grid-template-columns: 56px minmax(0, 1fr);
}

/* Rail */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  gap: 2px;
}
.nav {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.nav:hover {
  color: var(--text);
  background: var(--hover);
}
.nav.on {
  color: var(--text);
  background: var(--surface);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--line);
}
.nav .count {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  font: 500 9.5px/14px "Geist Mono", monospace;
  text-align: center;
  color: var(--muted);
}
.nav .count.hot {
  background: var(--gold);
  color: var(--bg);
}
.nav .count:empty {
  display: none;
}
.nav .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.nav[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.rail .sep {
  width: 18px;
  height: 1px;
  background: var(--line-strong);
  margin: 8px 0;
}
.rail .grow {
  flex: 1;
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone, var(--c-ok));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--c-ok)) 18%, transparent);
}
[data-tone="slowed"] {
  --tone: var(--c-warn);
}
[data-tone="stopped"] {
  --tone: var(--c-stop);
}
[data-tone="unknown"] {
  --tone: var(--faint);
}

/* Main panel */
.main {
  background: var(--surface);
  border-radius: 12px 0 0 12px;
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.app.no-side .main {
  border-radius: 12px;
}
.head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.head.with-back {
  padding-left: 10px;
}
.head h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head .n {
  color: var(--faint);
  font-size: 12px;
}
.head .sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.head .hints {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 11.5px;
  white-space: nowrap;
}
.head .hints span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.head .tools {
  display: flex;
  gap: 2px;
  margin-left: 4px;
}
.head .hints + .tools {
  margin-left: 8px;
}
.head .spacer {
  margin-left: auto;
}
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn.spin svg {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--tone, var(--c-warn)) 10%, var(--surface));
  color: var(--text);
  font-size: 12.5px;
  flex: none;
}
.banner p {
  margin: 0;
  flex: 1;
}

.chips {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  flex: none;
  align-items: center;
  flex-wrap: wrap;
}
.chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover {
  color: var(--text);
  background: var(--hover);
}
.chip.on {
  color: var(--text);
  background: var(--selected);
}
.chip .mono {
  color: var(--faint);
  font-size: 11px;
}
.chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.chips .scanline {
  margin-left: auto;
  color: var(--faint);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.chips .scanline .pulse {
  width: 6px;
  height: 6px;
}
.scanline.running .pulse {
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}
.scanline button {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.list {
  overflow: auto;
  flex: 1;
  padding: 6px 8px 24px;
  outline: none;
}
.group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 12px 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}
.group .mono {
  color: var(--faint);
  font-size: 11px;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(110px, 176px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: default;
}
.row:hover {
  background: var(--hover);
}
.row.sel {
  background: var(--selected);
}
.row .name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}
.row.unread .name {
  font-weight: 600;
}
.row.unread::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--gold);
}
.row .prev {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.row.unread .prev .t {
  color: var(--text-2);
}
.row .prev .t {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.row .prev .you {
  color: var(--faint);
}
.row .prev .draft {
  color: var(--c-rose);
}
.row .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 64px;
}
.row time {
  color: var(--faint);
  font-size: 11.5px;
  white-space: nowrap;
}
.row .acts {
  display: none;
  gap: 1px;
  align-items: center;
}
.row.sel time {
  display: none;
}
.row.sel .acts {
  display: flex;
}
.enter-hint {
  display: inline-flex;
  margin-right: 6px;
}
.act-btn,
.btn {
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.act-btn:hover,
.btn:hover {
  background: var(--hover);
  color: var(--text);
}
.btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.act-btn.primary,
.btn.primary {
  background: var(--text);
  color: var(--bg);
  padding: 0 10px;
  font-weight: 500;
  box-shadow: none;
}
.btn.primary {
  padding: 0 14px;
}
.act-btn.primary:hover,
.btn.primary:hover {
  opacity: 0.88;
  background: var(--text);
  color: var(--bg);
}
.act-btn.primary:disabled,
.btn:disabled {
  opacity: 0.35;
}
.act-btn kbd,
.btn kbd {
  background: transparent;
  padding: 0;
  min-width: 0;
  color: inherit;
  opacity: 0.55;
}
.more-row {
  display: flex;
  justify-content: center;
  padding: 14px 0 4px;
}

.av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
  overflow: hidden;
  background: color-mix(in srgb, var(--h) 14%, var(--surface));
  color: color-mix(in srgb, var(--h) 80%, var(--text));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--h) 22%, transparent);
}
.av.h0 { --h: #3f7fd1; }
.av.h1 { --h: #7a5cd6; }
.av.h2 { --h: #2f9e62; }
.av.h3 { --h: #c9952a; }
.av.h4 { --h: #d2553f; }
.av.h5 { --h: #2a9aa0; }
.av.h6 { --h: #b05a9a; }
.av.h7 { --h: #5f6bd6; }
.t-gold { --c: var(--c-gold); }
.t-blue { --c: var(--c-blue); }
.t-rose { --c: var(--c-rose); }
.t-amber { --c: var(--c-amber); }
.t-violet { --c: var(--c-violet); }
.t-slate { --c: var(--c-slate); }
.t-ok { --c: var(--c-ok); }
.t-warn { --c: var(--c-warn); }
.nav .dot,
.chip i,
.pal li .dot {
  background: var(--c);
}
.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.av.lg {
  width: 40px;
  height: 40px;
  font-size: 13px;
}
.av.xl {
  width: 44px;
  height: 44px;
  font-size: 14px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  flex: none;
}
.tag i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
}
.tag.soft {
  color: var(--muted);
}

.empty {
  margin: auto;
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.empty h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.empty p {
  margin: 0;
  max-width: 44ch;
}
.empty .actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Thread */
.thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.msgs {
  flex: 1;
  overflow: auto;
  padding: 20px max(24px, calc((100% - 680px) / 2)) 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.msgs .history {
  align-self: center;
  margin-bottom: 8px;
}
.day {
  align-self: center;
  color: var(--faint);
  font-size: 11px;
  margin: 14px 0 8px;
}
.sys {
  align-self: center;
  color: var(--faint);
  font-size: 11.5px;
  margin: 6px 0;
  text-align: center;
}
.b {
  max-width: 72%;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--bubble);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text);
  line-height: 1.5;
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  align-self: flex-start;
}
.b.start {
  margin-top: 8px;
}
.b.me {
  align-self: flex-end;
  background: var(--self);
  color: var(--self-ink);
  box-shadow: none;
}
.b a {
  color: inherit;
  text-underline-offset: 2px;
}
.b blockquote {
  margin: 0 0 6px;
  padding-left: 8px;
  border-left: 2px solid currentColor;
  opacity: 0.65;
  font-size: 12.5px;
}
.b .state {
  display: block;
  opacity: 0.6;
  font-size: 11px;
  margin-top: 3px;
}
.att {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
  text-align: left;
}
.att-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  display: block;
}
.empty-thread {
  margin: auto;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.empty-thread .av {
  margin-bottom: 10px;
}
.empty-thread p {
  margin: 0;
}
.warn-row {
  margin: 0 max(16px, calc((100% - 712px) / 2)) 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--c-warn) 10%, var(--surface));
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.warn-row p {
  margin: 0;
  flex: 1;
}
.composer {
  margin: 0 max(16px, calc((100% - 712px) / 2)) 16px;
  border-radius: 12px;
  background: var(--raised);
  box-shadow: var(--shadow-md);
  flex: none;
}
.composer textarea {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  padding: 14px 16px 6px;
  min-height: 72px;
  max-height: 280px;
  outline: none;
  field-sizing: content;
}
.composer textarea::placeholder {
  color: var(--faint);
}
.composer textarea:disabled {
  opacity: 0.5;
}
.composer .bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px;
}
.composer .check {
  color: var(--faint);
  font-size: 11.5px;
  margin-left: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.composer .check.block {
  color: var(--c-stop);
}
.composer .check.warn {
  color: var(--c-warn);
}
.composer .send {
  margin-left: auto;
}

/* Details */
.side {
  overflow: auto;
  padding: 18px 18px 18px 22px;
  display: flex;
  flex-direction: column;
}
.side-empty {
  color: var(--faint);
  margin: 40px 0 0;
  text-align: center;
}
.who {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.who h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.who p {
  margin: 2px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.props {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  row-gap: 2px;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.props dt {
  color: var(--muted);
  font-size: 12px;
  min-height: 30px;
  display: flex;
  align-items: center;
}
.props dd {
  margin: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--text-2);
  min-width: 0;
}
.props .ghost {
  color: var(--faint);
}
.props a {
  color: var(--text-2);
  text-decoration: none;
}
.props a:hover {
  color: var(--text);
}
.prop-btn {
  min-height: 26px;
  padding: 2px 8px;
  margin-left: -8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  text-align: left;
}
.prop-btn:hover {
  background: var(--hover);
}
.side .section {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 16px;
}
.note {
  margin-top: 8px;
  min-height: 140px;
  flex: 1;
  padding: 0;
  color: var(--text);
  border: 0;
  background: transparent;
  outline: none;
  resize: none;
  line-height: 1.55;
}
.note::placeholder {
  color: var(--faint);
}

/* Settings */
.page {
  overflow: auto;
  flex: 1;
  padding: 24px max(24px, calc((100% - 640px) / 2)) 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.page section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.page h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}
.page p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}
.page .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.setting {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.setting > div {
  flex: 1;
  min-width: 0;
}
.setting strong {
  display: block;
  font-weight: 500;
}
.setting small {
  color: var(--muted);
  font-size: 12px;
}
.seg {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px;
  border-radius: 8px;
  background: var(--kbd);
}
.seg button {
  height: 26px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.seg button.on {
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.switch {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--line-strong);
  position: relative;
  flex: none;
}
.switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.switch[aria-checked="true"] {
  background: var(--gold);
}
.switch[aria-checked="true"] span {
  transform: translateX(14px);
}
.switch:disabled {
  opacity: 0.4;
}
.days {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.days label {
  position: relative;
}
.days input {
  position: absolute;
  opacity: 0;
  inset: 0;
}
.days span {
  display: inline-grid;
  place-items: center;
  height: 28px;
  min-width: 40px;
  padding: 0 8px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}
.days input:checked + span {
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}
.days input:focus-visible + span {
  outline: 2px solid var(--gold);
}
.times {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
input[type="time"],
input[type="datetime-local"],
input[type="text"],
select {
  height: 30px;
  border-radius: 8px;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  background: var(--surface);
  padding: 0 10px;
  color: var(--text);
}
.page.inner {
  padding: 0;
  gap: 22px;
}
details.advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}
details.advanced[open] summary {
  margin-bottom: 14px;
}
pre.diag {
  font: 11px/1.5 "Geist Mono", monospace;
  background: var(--kbd);
  border-radius: 8px;
  padding: 10px;
  overflow: auto;
  max-height: 200px;
  margin: 0;
}

/* Dialog */
dialog {
  border: 0;
  padding: 0;
  border-radius: 14px;
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
}
dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(2px);
}
#dialog-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  max-height: calc(100vh - 64px);
}
#dialog-form h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
#dialog-form p,
#dialog-form li {
  margin: 0;
  color: var(--text-2);
}
#dialog-form ul,
#dialog-form ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
#dialog-form label.check {
  flex-direction: row;
  align-items: center;
  color: var(--text-2);
  font-size: 13px;
}
#dialog-form footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.small {
  color: var(--muted);
  font-size: 12px;
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bar-row .top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
}
.bar-row progress {
  appearance: none;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--kbd);
  overflow: hidden;
  --bar: var(--c-ok);
}
.bar-row progress::-webkit-progress-bar {
  background: var(--kbd);
}
.bar-row progress::-webkit-progress-value {
  background: var(--bar);
  border-radius: 2px;
}
.bar-row[data-level="near"] progress {
  --bar: var(--c-warn);
}
.bar-row[data-level="full"] progress {
  --bar: var(--c-stop);
}
.notice {
  padding: 10px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--tone, var(--c-warn)) 10%, var(--raised));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Palette */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: start center;
  padding: 16vh 16px 0;
  z-index: 20;
}
.pal {
  width: min(540px, 100%);
  background: var(--raised);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.pal .ctx {
  padding: 12px 16px 0;
}
.pal .ctx span {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--kbd);
  padding: 3px 8px;
  border-radius: 6px;
}
.pal input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  padding: 12px 16px 14px;
  outline: none;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  height: auto;
  border-radius: 0;
}
.pal input::placeholder {
  color: var(--faint);
}
.pal ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 360px;
  overflow: auto;
}
.pal li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  cursor: default;
}
.pal li.hi {
  background: var(--selected);
  color: var(--text);
}
.pal li svg.i {
  color: var(--muted);
}
.pal li .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin: 0 4.5px;
  flex: none;
}
.pal li .pl {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.pal li .pl small {
  color: var(--faint);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pal li .on {
  color: var(--gold);
  display: inline-flex;
}
.pal li kbd {
  margin-left: auto;
}
.pal-empty {
  margin: 0;
  padding: 18px 16px;
  color: var(--muted);
}
.pal .foot {
  display: flex;
  gap: 14px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
}
.pal .foot span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.pal input[type="datetime-local"] {
  font-size: 13px;
}

/* Toast */
#toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  opacity: 0;
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  pointer-events: none;
  z-index: 30;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: min(560px, calc(100vw - 32px));
}
#toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%);
}
@media (prefers-reduced-motion: no-preference) {
  #toast {
    transition:
      opacity 0.18s,
      transform 0.18s;
  }
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .main {
    border-radius: 12px;
  }
  .side {
    display: none;
  }
  .head .hints {
    display: none;
  }
}

/* The Relay Connector's own page */
body.connector {
  display: grid;
  place-items: start center;
  padding: 48px 16px;
  min-height: 100%;
}
.connector-card {
  width: min(560px, 100%);
  background: var(--surface);
  border-radius: 14px;
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.connector-card header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.connector-card h1 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.connector-card section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.connector-card h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}
.connector-card p {
  margin: 0;
  color: var(--muted);
}
.connector-card .actions {
  display: flex;
  gap: 8px;
}
.connector-card a.btn {
  text-decoration: none;
}
.connector-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 600;
  flex: none;
}
