:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.55;
  --text: #20322b;
  --canvas: #f4f7f5;
  --surface: #fff;
  --sidebar: #fcfdfc;
  --surface-subtle: #f7faf8;
  --surface-hover: #eff5f0;
  --muted: #566a60;
  --border: #e0e8e3;
  --input-border: #d8e4dc;
  --accent: #2b614e;
  --accent-strong: #204b3b;
  --accent-ink: #204b3b;
  --accent-on: #fff;
  --accent-soft: #e8f1eb;
  --wash: #e0eee5;
  --flow-base: #193e33;
  --flow-end: #244e40;
  --flow-glow: #356954;
  --flow-border: #234b3e;
  --flow-node: #30604e;
  --flow-active: #bce2c7;
  --flow-active-ink: #254c3c;
  --flow-ink: #f1faf4;
  --flow-muted: #d1e4d9;
  --flow-dots: #bee0ca;
  --danger: #ac3b3e;
  --danger-bg: #faeceb;
  --danger-solid: #ac3b3e;
  --danger-on: #fff;
  --danger-hover: #8c292e;
  --overlay: #152a2370;
  --shadow: 0 3px 8px #183d2b04, 0 1px 2px #183d2b05;
  --floating-shadow: 0 15px 65px #132e2540;
  --motion-ease: cubic-bezier(.2, .7, .24, 1);
  --dialog-duration: 260ms;
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --text: #e2ebe5;
  --canvas: #121815;
  --surface: #1a231e;
  --sidebar: #171f1a;
  --surface-subtle: #202b24;
  --surface-hover: #28372e;
  --muted: #a9bdb0;
  --border: #2e3c33;
  --input-border: #3f5145;
  --accent: #abd7be;
  --accent-strong: #c4e5d1;
  --accent-ink: #c0e1cc;
  --accent-on: #182e23;
  --accent-soft: #2b4235;
  --wash: #1f382a;
  --flow-base: #192e25;
  --flow-end: #213a2f;
  --flow-glow: #284a3b;
  --flow-border: #385747;
  --flow-node: #2c4c3d;
  --danger: #f0a7aa;
  --danger-bg: #3c262a;
  --danger-solid: #e2979a;
  --danger-on: #38171a;
  --danger-hover: #f0aeb0;
  --overlay: #080d0abe;
  --shadow: 0 3px 10px #0003;
  --floating-shadow: 0 15px 65px #0008;
}

:root[data-palette="mono"] {
  --text: #202020;
  --canvas: #f5f5f5;
  --surface: #fff;
  --sidebar: #fcfcfc;
  --surface-subtle: #f7f7f7;
  --surface-hover: #ededed;
  --muted: #5e5e5e;
  --border: #e3e3e3;
  --input-border: #dadada;
  --accent: #252525;
  --accent-strong: #090909;
  --accent-ink: #252525;
  --accent-on: #fff;
  --accent-soft: #eaeaea;
  --wash: #e4e4e4;
  --flow-base: #202020;
  --flow-end: #2b2b2b;
  --flow-glow: #404040;
  --flow-border: #333;
  --flow-node: #383838;
  --flow-active: #ececec;
  --flow-active-ink: #252525;
  --flow-ink: #fafafa;
  --flow-muted: #dadada;
  --flow-dots: #d6d6d6;
  --danger: var(--text);
  --danger-bg: var(--surface-hover);
  --danger-solid: var(--accent);
  --danger-on: var(--accent-on);
  --danger-hover: var(--accent-strong);
  --overlay: #18181880;
  --shadow: 0 3px 8px #00000009, 0 1px 2px #00000007;
  --floating-shadow: 0 15px 65px #0004;
}

:root[data-palette="mono"][data-mode="dark"] {
  --text: #efefef;
  --canvas: #141414;
  --surface: #1c1c1c;
  --sidebar: #181818;
  --surface-subtle: #222;
  --surface-hover: #2c2c2c;
  --muted: #b7b7b7;
  --border: #333;
  --input-border: #484848;
  --accent: #eee;
  --accent-strong: #fff;
  --accent-ink: #f5f5f5;
  --accent-on: #1b1b1b;
  --accent-soft: #333;
  --wash: #282828;
  --flow-base: #222;
  --flow-end: #2c2c2c;
  --flow-glow: #373737;
  --flow-border: #414141;
  --overlay: #080808bf;
  --shadow: 0 3px 10px #0003;
  --floating-shadow: 0 15px 65px #0008;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { display: block; width: 18px; height: 18px; flex-shrink: 0; }
code, pre { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; }
.muted { color: var(--muted); }

.startup { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 710; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--accent-on);
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 2px 4px #0002, inset 0 1px 0 #ffffff32;
}
.brand-mark svg { width: 23px; height: 23px; }
.login-view {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 35% 10%, var(--wash), transparent 55%), var(--canvas);
}
.login-appearance { position: absolute; inset: 16px 16px auto auto; }
.login-card { width: min(100%, 410px); margin-top: 24px; padding: 33px; border: 1px solid var(--border); border-radius: 21px; background: var(--surface); box-shadow: var(--shadow); animation: page-in 340ms var(--motion-ease) both; }
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { margin-bottom: 6px; font-size: 25px; }
.login-card form { margin-top: 25px; }
.login-card .primary { justify-content: space-between; }

.workspace { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 29px 15px 17px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-brand { align-self: flex-start; margin: 0 0 35px 7px; }
.navigation { display: grid; gap: 5px; }
.navigation a, .navigation button, .sidebar-logout {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  background: transparent;
  border: 0;
  transition: background-color 180ms ease, color 180ms ease;
}
.navigation a:hover, .navigation button:hover, .sidebar-logout:hover { background: var(--surface-hover); color: var(--accent-ink); }
.navigation a[aria-current] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 680; }
.sidebar-footer { margin-top: auto; }
.instance { display: flex; align-items: center; gap: 10px; margin: 0 0 9px; padding: 11px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.instance > div { min-width: 0; }
.instance strong { display: block; margin-top: 2px; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { width: 100%; border: 0; background: transparent; text-align: left; }

.main-content { width: min(100%, 1210px); margin: 0 auto; padding: 49px clamp(25px, 4vw, 56px) 56px; }
.page:not([hidden]) { animation: page-in 320ms var(--motion-ease) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(25px, 3vw, 34px); font-weight: 730; letter-spacing: -.035em; }
.page-heading p { color: var(--muted); }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 640;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--motion-ease);
}
.button:not(:disabled):active { transform: translateY(1px) scale(.98); }
.button.primary { color: var(--accent-on); background: var(--accent); border-color: var(--accent); box-shadow: 0 2px 3px #0002; }
.button.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.button.secondary { background: var(--surface); border-color: var(--input-border); }
.button.secondary:hover:not(:disabled), .button.quiet:hover:not(:disabled) { background: var(--surface-hover); }
.button.quiet { color: var(--muted); background: transparent; }
.button.small { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.button.small svg { width: 15px; height: 15px; }
.button.danger-quiet { color: var(--danger); background: transparent; }
.button.danger-quiet:hover:not(:disabled) { background: var(--danger-bg); }
.button.danger { color: var(--danger-on); background: var(--danger-solid); }
.button.danger:hover:not(:disabled) { background: var(--danger-hover); }

.flow-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(18px, 5vw, 72px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 168px;
  margin-bottom: 25px;
  padding: 26px clamp(22px, 3vw, 36px);
  border: 1px solid var(--flow-border);
  border-radius: 16px;
  color: var(--flow-ink);
  background: radial-gradient(ellipse at 86% 12%, var(--flow-glow), transparent 65%), linear-gradient(110deg, var(--flow-base), var(--flow-end));
  box-shadow: var(--shadow);
}
.flow-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .27;
  background: radial-gradient(circle, var(--flow-dots) 1px, transparent 1.3px) 0 0 / 16px 16px;
  mask-image: linear-gradient(90deg, transparent 24%, black 100%);
}
.flow-copy h2 { font-size: clamp(18px, 2vw, 24px); letter-spacing: -.025em; margin-bottom: 8px; }
.flow-copy p { max-width: 34em; color: var(--flow-muted); font-size: 13px; line-height: 1.85; }
.flow { display: flex; align-items: flex-start; }
.flow-step { display: grid; justify-items: center; gap: 7px; min-width: 65px; color: var(--flow-ink); font-size: 11px; white-space: nowrap; }
.flow-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #ffffff32; border-radius: 14px; color: var(--flow-ink); background: var(--flow-node); box-shadow: 0 3px 7px #0003, inset 0 1px #ffffff1c; }
.flow-icon svg { width: 22px; height: 22px; }
.flow-icon.flow-active { color: var(--flow-active-ink); background: var(--flow-active); }
.flow-connector { position: relative; width: clamp(17px, 3.2vw, 49px); margin-top: 24px; border-top: 1px dashed var(--flow-dots); opacity: .6; }
.flow-connector::after { content: ""; position: absolute; top: -3px; right: 0; width: 5px; height: 5px; border-top: 1px solid var(--flow-dots); border-right: 1px solid var(--flow-dots); transform: rotate(45deg); }

.panel { overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 65px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.panel-heading h2, .info-panel h2, .guide-card h2 { font-size: 16px; font-weight: 690; }
.section-title { display: flex; align-items: center; gap: 8px; }
.count { padding: 1px 7px; border-radius: 6px; color: var(--muted); background: var(--surface-hover); font-size: 11px; font-variant-numeric: tabular-nums; }
.search { position: relative; display: flex; align-items: center; width: min(230px, 56%); }
.search > span { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.search svg { width: 16px; height: 16px; }
.search input { padding: 6px 10px 6px 31px; min-height: 36px; font-size: 12px; }
.empty { min-height: 222px; display: grid; justify-items: center; align-content: center; gap: 7px; padding: 28px 19px; text-align: center; }
.empty h3 { font-size: 15px; }
.empty p { color: var(--muted); font-size: 13px; }
.empty-icon { display: grid; place-items: center; width: 49px; height: 49px; margin-bottom: 5px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 15px; }
.empty-icon svg { width: 23px; height: 23px; }
.empty .button { margin-top: 7px; }
.relay-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.relay-table th { background: var(--surface-subtle); color: var(--muted); text-align: left; font-size: 12px; font-weight: 570; }
.relay-table td, .relay-table th { padding: 10px 10px; }
.relay-table th:first-child, .relay-table td:first-child { padding-left: 20px; }
.relay-table th:nth-child(1) { width: 25%; }
.relay-table th:nth-child(3) { width: 119px; }
.relay-table th:last-child { width: 172px; }
.relay-table td { border-top: 1px solid var(--border); }
.name-cell { font-size: 13px; }
.name-cell strong { font-weight: 660; overflow-wrap: anywhere; vertical-align: middle; }
.cell-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; color: var(--accent-ink); border-radius: 9px; background: var(--surface-hover); vertical-align: middle; }
.name-cell .cell-icon { margin-right: 7px; }
.cell-icon svg { width: 16px; height: 16px; }
.url-cell code { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; color: var(--muted); background: var(--surface-hover); border-radius: 7px; font-size: 11px; white-space: nowrap; }
.rule-chip.restricted { color: var(--accent-ink); background: var(--accent-soft); }
.rule-chip svg { width: 14px; height: 14px; }
.table-actions { white-space: nowrap; }
.table-actions .button + .button { margin-left: 2px; }

.info-panel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 24px; padding: 19px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-hover); }
.info-icon, .guide-icon { display: grid; place-items: center; width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; }
.info-panel p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.ip-display { display: grid; min-width: 108px; padding-left: 16px; border-left: 1px solid var(--input-border); color: var(--muted); font-size: 11px; }
.ip-display code { color: var(--accent-ink); margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }
.access-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 14px 20px; }
.access-row + .access-row { border-top: 1px solid var(--border); }
.access-row h3 { font-size: 13px; overflow-wrap: anywhere; }
.access-rules { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.access-rules code { max-width: 100%; padding: 1px 5px; border-radius: 4px; color: var(--accent-ink); background: var(--accent-soft); font-size: 11px; overflow-wrap: anywhere; }

.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.guide-card { padding: 20px; }
.guide-icon { margin-bottom: 14px; }
.guide-card p { margin-top: 8px; color: var(--muted); line-height: 1.85; font-size: 13px; }
.guide-example { margin-top: 16px; }
.guide-example pre { margin: 14px 0; padding: 14px; overflow-x: auto; border-radius: 9px; background: var(--surface-subtle); color: var(--accent-ink); font-size: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 13px; padding: 0; border: 0; color: var(--accent-ink); background: transparent; font-weight: 640; font-size: 13px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-link svg { width: 14px; height: 14px; }

input:where(:not([type="radio"], [type="checkbox"])), textarea, select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid var(--input-border); border-radius: 9px; color: inherit; background: var(--surface-subtle); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
input:disabled { opacity: .65; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
.field, .form-stack { display: grid; gap: 6px; }
.form-stack { gap: 15px; }
.field > span, .detail-url label { font-size: 13px; font-weight: 660; }
.field small, .field-help { color: var(--muted); font-size: 12px; }
.field small.optional { font-weight: 450; margin-left: 4px; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 32px; width: fit-content; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-field input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: inherit; }
.form-error { padding: 8px 10px; color: var(--danger); background: var(--danger-bg); border-radius: 7px; font-size: 13px; overflow-wrap: anywhere; }

dialog { width: min(510px, calc(100vw - 28px)); max-height: calc(100dvh - 26px); padding: 22px; border: 1px solid var(--border); border-radius: 17px; color: inherit; background: var(--surface); box-shadow: var(--floating-shadow); }
dialog::backdrop { background: var(--overlay, #16161680); backdrop-filter: blur(4px); }
dialog[open] { animation: dialog-in var(--dialog-duration) var(--motion-ease) both; }
dialog[open]::backdrop { animation: fade-in var(--dialog-duration, 260ms) ease both; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@supports (transition-behavior: allow-discrete) and (overlay: auto) {
  dialog {
    opacity: 0;
    transform: translateY(12px) scale(.98);
    pointer-events: none;
    transition: opacity var(--dialog-duration) ease, transform var(--dialog-duration) var(--motion-ease), display var(--dialog-duration) allow-discrete, overlay var(--dialog-duration) allow-discrete;
  }
  dialog::backdrop {
    --backdrop-duration: var(--dialog-duration, 260ms);
    opacity: 0;
    transition: opacity var(--backdrop-duration) ease, display var(--backdrop-duration) allow-discrete, overlay var(--backdrop-duration) allow-discrete;
  }
  dialog[open] { opacity: 1; transform: none; pointer-events: auto; animation: none; }
  dialog[open]::backdrop { opacity: 1; animation: none; }
  @starting-style {
    dialog[open] { opacity: 0; transform: translateY(12px) scale(.98); }
    dialog[open]::backdrop { opacity: 0; }
  }
}

.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; margin-bottom: 19px; }
.dialog-heading h2 { font-size: 19px; overflow-wrap: anywhere; }
.dialog-heading p { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; margin: -5px -4px 0 0; padding: 0; border: 0; border-radius: 9px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--accent-ink); background: var(--surface-hover); }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.split-actions { justify-content: space-between; margin-top: 12px; }
.detail-url { display: grid; gap: 6px; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.copy-field input { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.detail-settings { margin: 15px 0 13px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-row { display: flex; width: 100%; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 0; background: var(--surface-subtle); color: inherit; text-align: left; font-size: 13px; }
.detail-row:focus-visible { outline-offset: -3px; }
.detail-row + .detail-row { border-top: 1px solid var(--border); }
.detail-row:hover { background: var(--surface-hover); }
.detail-row svg { width: 16px; height: 16px; color: var(--accent-ink); }
.row-end { margin-left: auto; font-size: 12px; }
#test-error { margin-top: 8px; }
#delete-name { overflow-wrap: anywhere; }

#inbound-signing > p { margin-bottom: 12px; }
.signing-content { display: grid; gap: 12px; }
#inbound-content { margin: 14px 0; }
.signing-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 9px; background: var(--surface-hover); }
.signing-status strong { font-size: 13px; }
.signing-key { grid-template-columns: minmax(0, 1fr) auto auto; }
.signing-rotation { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.signing-rotation button { min-height: 42px; }

#appearance { width: min(400px, calc(100vw - 28px)); }
.appearance-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.appearance-group legend { margin-bottom: 7px; padding: 0; font-size: 13px; font-weight: 660; }
.appearance-options { display: grid; gap: 6px; }
.palette-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appearance-options label { position: relative; cursor: pointer; }
.appearance-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.appearance-option { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 3px; border: 1px solid var(--input-border); border-radius: 8px; color: var(--muted); background: var(--surface-subtle); font-size: 12px; white-space: nowrap; transition: background-color 150ms ease, border-color 150ms ease; }
.appearance-options label:hover .appearance-option { background: var(--surface-hover); }
.appearance-options input:checked + .appearance-option { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); font-weight: 660; }
.appearance-options input:focus-visible + .appearance-option { outline: 2px solid var(--accent); outline-offset: 2px; }
.appearance-option svg { width: 16px; height: 16px; }
.palette-swatch { width: 17px; height: 17px; border: 1px solid var(--input-border); border-radius: 50%; }
.forest-swatch { background: linear-gradient(135deg, #34654e 50%, #dae9dc 50%); }
.mono-swatch { background: linear-gradient(135deg, #232323 50%, #eee 50%); }

.toasts { position: fixed; z-index: 3; inset: auto 18px 19px auto; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--accent-ink); background: var(--surface-hover); border: 1px solid var(--input-border); border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; overflow-wrap: anywhere; animation: page-in 200ms var(--motion-ease) both; }
.toast-error { color: var(--danger); background: var(--danger-bg); }
.dialog-toast { margin-top: 11px; box-shadow: none; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 177px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .main-content { padding-inline: 25px; }
  .flow-panel { gap: 17px; }
  .relay-table th:last-child { width: 155px; }
  .table-actions .button { padding-inline: 6px; }
}

@media (max-width: 760px) {
  .workspace { display: block; }
  .sidebar { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; height: auto; padding: 11px 16px 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-brand { align-self: center; margin: 0; font-size: 15px; }
  .sidebar-footer { grid-column: 2; grid-row: 1; margin-top: 0; }
  .sidebar-footer .instance, .logout-label { display: none; }
  .sidebar-logout { justify-content: center; min-width: 42px; }
  .navigation { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 9px; }
  .navigation a, .navigation button { justify-content: center; gap: 5px; min-height: 39px; padding-inline: 4px; }
  .navigation svg { width: 15px; height: 15px; }
  .main-content { padding: 22px 16px 36px; }
  .page-heading { margin-bottom: 17px; }
  .page-heading p { font-size: 13px; }
}

@media (max-width: 540px) {
  .page-heading { align-items: flex-start; gap: 10px; }
  .page-heading .button { margin-top: 2px; padding-inline: 8px; }
  .page-heading .button svg { width: 16px; height: 16px; }
  .flow-panel { grid-template-columns: 1fr; min-height: 0; gap: 16px; margin-bottom: 16px; padding: 17px; }
  .flow-copy h2 { margin-bottom: 4px; }
  .flow { justify-content: center; }
  .flow-icon { width: 43px; height: 43px; border-radius: 12px; }
  .flow-connector { width: 35px; margin-top: 21px; }
  .panel-heading { padding-inline: 13px; min-height: 56px; }
  .relay-table, .relay-table tbody { display: block; }
  .relay-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .relay-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 12px; }
  .relay-table tr + tr { border-top: 1px solid var(--border); }
  .relay-table td, .relay-table td:first-child { padding: 0; border: 0; }
  .url-cell { grid-column: 1; grid-row: 2; }
  .rules-cell { grid-column: 2; grid-row: 1; text-align: right; }
  .table-actions { grid-column: 2; grid-row: 2; }
  .info-panel { grid-template-columns: auto minmax(0, 1fr); gap: 9px; padding: 13px; }
  .ip-display { grid-column: 2; padding-left: 0; border: 0; }
  .access-row { padding-inline: 12px; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-card, dialog { padding: 16px; }
}

@media (max-width: 400px) {
  .navigation svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, dialog::backdrop { animation: none !important; transition: none !important; }
  .button:not(:disabled):active { transform: none; }
}
