/* Meridian — a quiet workspace for connected media.
   Tokens → shared controls → shell → pages → responsive rules.
   Major surfaces share a fixed 24px radius. */
@font-face {
  font-family: "Meridian Sans";
  src: url("../fonts/inter-ui.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Meridian CJK";
  src: url("../fonts/noto-sans-sc-ui.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --font-ui:
    "Meridian Sans", "Meridian CJK", "PingFang SC", "Microsoft YaHei",
    "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --black: #0a0c0f;
  --panel: #111419;
  --panel-soft: #0d1014;
  --panel-raised: #191d24;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --surface-active: rgba(255, 255, 255, 0.1);
  --glass: #111419;
  --glass-border: #242830;
  --panel-border: var(--glass-border);
  --white: #f2f4f8;
  --white-87: #d4d9e2;
  --white-60: #949cab;
  --white-38: #778190;
  --white-12: rgba(255, 255, 255, 0.12);
  --blue: #78aaff;
  --blue-dim: rgba(109, 157, 238, 0.1);
  --blue-glow: rgba(109, 157, 238, 0.16);
  --button-blue: #4686ee;
  --green: #66d4a6;
  --green-dim: rgba(102, 212, 166, 0.1);
  --red: #f08087;
  --red-dim: rgba(240, 128, 135, 0.1);
  --orange: #e4b572;
  --orange-dim: rgba(228, 181, 114, 0.1);
  --teal: #75c6dd;
  --teal-dim: rgba(117, 198, 221, 0.1);
  --purple: #b6a1ea;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --ui-radius: 24px;
  --page-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --space-2: 8px;
  --sidebar-w: 76px;
  --nav-h: 76px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23949cab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}
/* Kept for older saved theme preferences and embedded clients. */
html[data-theme="light"] {
  color-scheme: light;
  --black: #f5f6f8;
  --panel: #fff;
  --panel-soft: #f8f9fb;
  --panel-raised: #eef1f5;
  --surface: rgba(20, 30, 50, 0.035);
  --surface-hover: rgba(20, 30, 50, 0.06);
  --surface-active: rgba(20, 30, 50, 0.1);
  --glass: #fff;
  --glass-border: #e1e5eb;
  --white: #1a2230;
  --white-87: #374151;
  --white-60: #657083;
  --white-38: #778190;
  --white-12: rgba(20, 30, 50, 0.12);
  --blue: #326fcd;
  --button-blue: #3978dc;
  --green: #238561;
  --red: #c84d58;
  --orange: #996c27;
  --teal: #287f99;
  --purple: #8060be;
}

/* Foundation */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-overflow-scrolling: touch;
}
body {
  min-width: 320px;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-ui);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-y: visible;
}
body.modal-open {
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
body.auth-checking #page-login,
body.auth-checking #app-shell {
  visibility: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}
button:disabled,
select:disabled,
input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button,
a {
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}
::selection {
  background: #355d98;
  color: #fff;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #353b47 transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: #353b47;
  border-radius: 10px;
}
svg {
  flex-shrink: 0;
}
button svg,
.topnav-link svg,
.app-header svg,
.site-access-value svg,
.diag-icon svg,
.stat-icon-wrap svg,
.empty-state-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mono {
  font-family: var(--font-ui);
  font-size: inherit;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
}
.mono-subtle {
  color: var(--white-38);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 16px;
  z-index: 3000;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: none;
}
.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--white-38);
}
.section-title {
  font-size: 26px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.section-sub {
  margin-top: 8px;
  margin-bottom: 28px;
  color: var(--white-60);
  font-size: 13px;
  line-height: 1.8;
}
.eyebrow + .section-title {
  margin-top: 9px;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}
.fade-up,
.fade-in,
.scale-in {
  animation: fadeUp 0.22s var(--ease) both;
}
.stagger-1 {
  animation-delay: 0.02s;
}
.stagger-2 {
  animation-delay: 0.04s;
}
.stagger-3 {
  animation-delay: 0.06s;
}

/* Form controls: one size and focus language across all pages. */
.form-input-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-group {
  min-width: 0;
  margin-bottom: 22px;
}
.form-group > label,
.settings-field > span,
.telegram-field > span,
.telegram-field > label,
.request-log-date-field > span {
  display: block;
  margin-bottom: 9px;
  color: var(--white-87);
  font-size: 12px;
  font-weight: 500;
}
.form-input,
.form-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background-color: var(--panel-soft);
  color: var(--white);
  font-size: 13px;
  line-height: 20px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}
.form-input:hover:not(:disabled),
.form-select:hover:not(:disabled) {
  border-color: #414b5b;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--blue);
  background-color: var(--panel);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-input::placeholder {
  color: var(--white-38);
  opacity: 0.8;
}
textarea.form-input {
  display: block;
  min-height: 96px;
  resize: vertical;
}
.form-select,
select.form-input {
  appearance: none;
  padding-right: 40px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px;
  text-overflow: ellipsis;
}
select option {
  background: var(--panel);
  color: var(--white);
}
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  max-width: 100%;
}
input::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--button-blue);
  cursor: pointer;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--button-blue);
}
input:-webkit-autofill {
  -webkit-text-fill-color: var(--white);
  box-shadow: 0 0 0 1000px var(--panel-raised) inset;
}
.form-help,
.settings-field small,
.telegram-field small {
  display: block;
  margin-top: 8px;
  color: var(--white-38);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.form-help:empty {
  display: none;
}

.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgb(248 113 113 / 10%);
}
.field-error,
.settings-field .field-error {
  display: block;
  margin-top: 6px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.field-error[hidden] {
  display: none;
}
.cache-limit-grid .field-error {
  grid-column: 2;
  margin-top: -6px;
}
.secret-input-wrap {
  position: relative;
  width: 100%;
}
.secret-input-wrap .form-input {
  padding-right: 64px;
}
.secret-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 42px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--white-60);
  font-size: 12px;
}
.secret-toggle:hover {
  color: var(--white);
  background: var(--surface-hover);
}

/* Buttons */
.btn,
.btn-primary,
.btn-add,
.btn-ghost,
.btn-scan,
.btn-modal,
.telegram-btn,
.request-log-action,
.account-logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  color: var(--white-87);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.btn:hover:not(:disabled),
.btn-ghost:hover:not(:disabled),
.btn-modal.secondary:hover,
.telegram-btn.secondary:hover,
.request-log-action:hover {
  border-color: #414b5b;
  background: var(--surface-hover);
  color: var(--white);
}
.btn-primary,
.btn-add,
.btn-scan,
.btn-modal.primary,
.telegram-btn.primary,
.btn-login {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--button-blue);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover:not(:disabled),
.btn-add:hover:not(:disabled),
.btn-scan:hover:not(:disabled),
.btn-modal.primary:hover:not(:disabled),
.telegram-btn.primary:hover:not(:disabled),
.btn-login:hover:not(:disabled) {
  background: #5794f9;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-ghost.danger,
.telegram-btn.danger,
.request-log-action.danger,
.account-logout-button {
  color: var(--red);
  background: transparent;
}
.btn-ghost.danger:hover,
.telegram-btn.danger:hover,
.request-log-action.danger:hover,
.account-logout-button:hover {
  background: var(--red-dim);
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red);
}
.icon-button,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--white-60);
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.icon-button:hover,
.modal-close:hover {
  background: var(--surface-hover);
  color: var(--white);
}
.btn-scan.running {
  opacity: 0.6;
  pointer-events: none;
}

/* Sign in and first-time setup */
#page-login {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 36px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(
      ellipse at 8% 40%,
      rgba(78, 106, 164, 0.06),
      transparent 55%
    ),
    var(--black);
}
#page-login.hidden {
  display: none;
}
.auth-layout {
  width: min(1240px, 100%);
  min-height: min(790px, calc(100dvh - 72px));
  display: grid;
  grid-template-columns: 1.06fr 1fr;
}
.auth-story {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 28px 64px 24px 24px;
  border-right: 1px solid var(--glass-border);
}
.auth-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.045em;
}
.auth-wordmark img {
  width: 38px;
  height: 38px;
}
.auth-wordmark-label {
  margin-left: 9px;
  padding-left: 16px;
  border-left: 1px solid var(--glass-border);
  color: var(--white-38);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
}
.auth-story-content {
  margin-block: auto;
  padding-block: 54px 30px;
}
.auth-story-content .eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
}
.auth-story h1 {
  margin-top: 0;
  font-size: clamp(38px, 3.7vw, 54px);
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.auth-story h1 span {
  color: #929baa;
}
.auth-story p {
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.95;
  color: var(--white-60);
}
.auth-connection {
  position: relative;
  width: min(420px, 100%);
  height: 230px;
  margin-top: 24px;
  overflow: hidden;
}
.connection-orbit {
  position: absolute;
  width: 238px;
  height: 238px;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  border: 1px solid #242b3a;
  border-radius: 50%;
  opacity: 0.65;
}
.orbit-two {
  width: 340px;
  height: 340px;
  border-color: #1e2532;
  opacity: 0.45;
}
.connection-path {
  position: absolute;
  top: 49%;
  left: 40px;
  right: 40px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    #425a7d 24%,
    #425a7d 76%,
    transparent
  );
}
.connection-hub {
  position: absolute;
  top: 49%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid #344157;
  border-radius: 22px;
  background: linear-gradient(145deg, #1e2735, #11151c);
  box-shadow: 0 0 60px rgba(100, 153, 225, 0.08);
}
.connection-hub img {
  width: 61px;
  height: 61px;
}
.connection-node {
  position: absolute;
  top: 49%;
  transform: translateY(-50%);
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 15px 6px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: #10141b;
  color: #9caabe;
  font-size: 12px;
}
.connection-node svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.connection-client {
  left: 0;
}
.connection-library {
  right: 0;
}
.connection-caption {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  color: #687486;
  font-size: 12px;
  letter-spacing: 0.14em;
}
.auth-story-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--white-38);
  font-size: 12px;
}
.auth-form-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 45px 54px 58px 76px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  animation: fadeUp 0.4s var(--ease) both;
}
.login-brand {
  margin-bottom: 32px;
}
.auth-form-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 17px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.17em;
}
.auth-form-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}
.login-brand h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
}
.login-brand p {
  margin-top: 10px;
  color: var(--white-60);
  font-size: 12px;
}
.login-card .form-input {
  min-height: 48px;
  background-color: #11151b;
  border-color: #2a303a;
  padding-left: 15px;
}
.login-card .form-input:focus {
  border-color: var(--blue);
}
.login-card .form-group {
  margin-bottom: 21px;
}
.login-card .form-group > label {
  font-size: 12px;
  margin-bottom: 8px;
}
.btn-login {
  width: 100%;
  min-height: 47px;
  margin-top: 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease;
}
.login-footer {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  color: var(--white-38);
  font-size: 12px;
  text-align: center;
}
.login-note {
  display: block;
  margin-top: 8px;
}
.login-note.warn {
  color: var(--orange);
}
.auth-form-footer {
  position: absolute;
  bottom: 24px;
  left: 76px;
  right: 54px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--white-38);
  font-size: 12px;
}
.auth-form-footer a:hover {
  color: var(--blue);
}
.is-setup .auth-form-area {
  padding-top: 24px;
  padding-bottom: 65px;
}
.is-setup .login-brand {
  margin-bottom: 22px;
}
.is-setup .login-card .form-group {
  margin-bottom: 16px;
}
.is-setup .login-card .form-help {
  font-size: 12px;
  margin-top: 5px;
}
.auth-check-status,
.login-rate-limit {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--white-60);
  font-size: 12px;
}
.auth-check-status.error,
.login-rate-limit {
  color: var(--orange);
  background: var(--orange-dim);
}
.setup-recovery {
  margin-top: 7px;
  color: var(--white-38);
  font-size: 12px;
}
.setup-recovery summary {
  cursor: pointer;
}
.setup-recovery p {
  margin-top: 6px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.auth-retry {
  margin-left: 10px;
  color: var(--blue);
  text-decoration: underline;
}

/* Application shell. The document remains the scroll container. */
#app-shell {
  display: none;
  --sidebar-w: 76px;
}
#app-shell.sidebar-expanded {
  --sidebar-w: 224px;
}
#app-shell.active {
  display: block;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  background: #0d0f13;
  border-right: 1px solid #20242b;
  z-index: 100;
  transition: width 0.2s var(--ease);
}
.sidebar-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding: 3px 6px 32px;
}
.sidebar-logo {
  width: 33px;
  height: 33px;
}
.sidebar-brand-name {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.05em;
}
.sidebar-version {
  margin: -4px 0 0 42px;
  color: var(--white-60);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 24px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-section-label {
  margin: 9px 12px 12px;
  font-size: 12px;
  color: var(--white-38);
  letter-spacing: 0.12em;
}
.sidebar-section-secondary {
  margin-top: 28px;
}
.sidebar .topnav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--white-60);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.topnav-link svg {
  width: 18px;
  height: 18px;
}
.sidebar .topnav-link:hover {
  color: var(--white);
  background: var(--surface);
}
.sidebar .topnav-link.active {
  color: var(--white);
  border-color: #2d3543;
  background: #1b2330;
}
.sidebar .topnav-link.active svg {
  color: #8fbaff;
}
.sidebar-note {
  margin-top: auto;
  padding: 30px 12px 20px;
  color: #667080;
  font-size: 12px;
  white-space: nowrap;
}
.sidebar-note-line {
  display: block;
  width: 25px;
  height: 2px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #678dbf, transparent);
}
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  margin-top: auto;
  flex-shrink: 0;
  padding: 12px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--surface);
}
.sidebar-account:hover,
.sidebar-account.active {
  background: var(--surface-hover);
  border-color: #3b4556;
}
.avatar-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 1px solid #3a4660;
  border-radius: 9px;
  background: #212c42;
  color: #b3ccf2;
  font-size: 12px;
  font-weight: 600;
}
.sidebar-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-account-copy strong {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 500;
}
.sidebar-account-copy small {
  color: var(--white-38);
  font-size: 12px;
}
.sidebar-account > svg {
  width: 15px;
  height: 15px;
  margin-left: auto;
  fill: none;
  stroke: var(--white-38);
  stroke-width: 1.6;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--nav-h);
  margin-left: var(--sidebar-w);
  padding: 16px 40px;
  border-bottom: 1px solid #1b2027;
  background: rgba(10, 12, 15, 0.9);
  backdrop-filter: blur(18px);
  transition: margin-left 0.2s var(--ease);
}
.app-header-leading,
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.sidebar-toggle,
.github-project-link {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--white-38);
}
.sidebar-toggle:hover,
.github-project-link:hover {
  color: var(--white);
  background: var(--surface-hover);
  border-color: var(--glass-border);
}
.github-project-link svg {
  fill: currentColor;
  stroke: none;
  width: 18px;
  height: 18px;
}
.app-header-icon {
  display: none;
}
.app-header-copy h1 {
  color: var(--white-87);
  font-size: 13px;
  font-weight: 500;
}
.app-header-copy p {
  display: none;
}
.header-workspace-label {
  color: var(--white-38);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.theme-toggle {
  display: none;
}
.sidebar-backdrop {
  display: none;
}
.main {
  margin-left: var(--sidebar-w);
  padding: 40px 40px 20px;
  transition: margin-left 0.2s var(--ease);
  outline: none;
}
.page {
  display: none;
  max-width: 1440px;
  margin-inline: auto;
}
.page.active {
  display: block;
}
.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: 1440px;
  margin: 40px auto 0;
  padding: 22px 0 8px;
  border-top: 1px solid #20242b;
  color: #636d7d;
  font-size: 12px;
}
.workspace-footer > span:first-child {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
@media (min-width: 769px) {
  #app-shell:not(.sidebar-expanded) .sidebar-brand {
    justify-content: center;
    padding-inline: 0;
    padding-bottom: 35px;
  }
  #app-shell:not(.sidebar-expanded) .sidebar-brand-name,
  #app-shell:not(.sidebar-expanded) .sidebar-version,
  #app-shell:not(.sidebar-expanded) .sidebar-section-label,
  #app-shell:not(.sidebar-expanded) .sidebar-note,
  #app-shell:not(.sidebar-expanded) .sidebar-account-copy,
  #app-shell:not(.sidebar-expanded) .sidebar-account > svg {
    display: none;
  }
  #app-shell:not(.sidebar-expanded) .sidebar .topnav-link {
    padding-inline: 0;
    justify-content: center;
  }
  #app-shell:not(.sidebar-expanded) .sidebar .topnav-link > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  #app-shell:not(.sidebar-expanded) .sidebar-account {
    margin-top: auto;
    padding-inline: 0;
    justify-content: center;
    border: 0;
    background: none;
  }
}

/* Shared surfaces and tables */
.glass-card,
.stat-card,
.site-card,
.dashboard-trend-card,
.dashboard-insight-card,
.diag-card,
.settings-panel,
.telegram-report-card,
.account-profile-card,
.account-settings-card,
.account-session-card,
.request-log-controls,
.request-log-table-card {
  min-width: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--ui-radius);
  background: var(--panel);
}
.glass-card {
  overflow: hidden;
}
.glass-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
}
.glass-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white-87);
  font-size: 13px;
  font-weight: 600;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 12px;
}
th {
  padding: 13px 20px;
  color: var(--white-38);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
td {
  padding: 17px 20px;
  color: var(--white-87);
  line-height: 1.65;
}
tr + tr td {
  border-top: 1px solid #20242b;
}
tbody tr:hover {
  background: var(--surface);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--white-60);
  font-size: 12px;
}
.status-led,
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--white-38);
}
.status-led.on,
.live-dot {
  background: var(--green);
}
.status-led.off {
  background: #687282;
}
.pill,
.site-mode-badge,
.site-feature-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--white-60);
  font-size: 12px;
  white-space: nowrap;
}
.pill-blue {
  color: var(--blue);
  background: var(--blue-dim);
  border-color: transparent;
}
.pill-teal {
  color: var(--teal);
  background: var(--teal-dim);
  border-color: transparent;
}
.pill-green {
  color: var(--green);
  background: var(--green-dim);
  border-color: transparent;
}
.pill-purple {
  color: var(--purple);
  border-color: transparent;
  background: rgba(182, 161, 234, 0.08);
}
.pill-orange {
  color: var(--orange);
  background: var(--orange-dim);
  border-color: transparent;
}
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  padding: 50px 24px;
  border: 1px dashed #303641;
  border-radius: var(--ui-radius);
  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(103, 144, 205, 0.04),
      transparent 65%
    ),
    var(--panel);
  text-align: center;
}
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border: 1px solid #323c4d;
  border-radius: 16px;
  background: #1a2230;
  color: var(--blue);
}
.empty-state-icon svg {
  width: 26px;
  height: 26px;
}
.empty-state h2 {
  font-size: 19px;
  font-weight: 500;
}
.empty-state p {
  margin: 9px 0 24px;
  max-width: 330px;
  color: var(--white-60);
  font-size: 12px;
  line-height: 1.9;
}
.empty-state-note {
  margin-top: 14px;
  color: var(--white-38);
  font-size: 12px;
}

/* Dashboard */
.dashboard-page-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}
.dashboard-page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  color: var(--white-60);
  font-size: 12px;
}
.dashboard-page-meta .mono {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid #294036;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-dim);
  font-size: 12px;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 34px;
}
.stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 32px;
  grid-template-rows: 32px 1fr;
  gap: 18px 5px;
  padding: 20px;
}
.stat-icon-wrap {
  grid-row: 1;
  grid-column: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--white-60);
}
.stat-icon-wrap svg {
  width: 17px;
  height: 17px;
}
.stat-title {
  grid-row: 1;
  grid-column: 1;
  align-self: center;
  color: var(--white-60);
  font-size: 12px;
}
.stat-number {
  grid-row: 2;
  grid-column: 1 / -1;
  font-size: clamp(23px, 2.2vw, 31px);
  line-height: 1.25;
  letter-spacing: -0.045em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-number small {
  font-size: max(12px, 0.48em);
  color: var(--white-38);
  font-weight: 400;
}
.stat-card.c-green .stat-icon-wrap {
  color: var(--green);
  background: var(--green-dim);
}
.stat-card.c-blue .stat-icon-wrap {
  color: var(--blue);
  background: var(--blue-dim);
}
.stat-card.c-teal .stat-icon-wrap {
  color: var(--teal);
  background: var(--teal-dim);
}
.stat-card.c-orange .stat-icon-wrap {
  color: var(--orange);
  background: var(--orange-dim);
}
.stat-card.c-purple .stat-icon-wrap {
  color: var(--purple);
  background: rgba(182, 161, 234, 0.08);
}
.dashboard-trend-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.dashboard-trend-toolbar .glass-card-title {
  font-size: 15px;
}
.dashboard-trend-help {
  margin-top: 5px;
  max-width: 460px;
  font-size: 12px;
  color: var(--white-38);
}
.dashboard-trend-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dashboard-trend-control {
  display: flex;
  align-items: center;
  gap: 9px;
}
.dashboard-trend-control > label {
  color: var(--white-38);
  font-size: 12px;
}
.dashboard-trend-controls .form-select {
  width: 144px;
  min-height: 42px;
  background-color: var(--panel);
}
.dashboard-trend-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.dashboard-trend-custom label {
  font-size: 12px;
  color: var(--white-60);
}
.dashboard-trend-custom .form-input {
  margin-top: 5px;
  font-size: 12px;
}
.dashboard-trend-custom-separator {
  padding-bottom: 11px;
  color: var(--white-38);
  font-size: 12px;
}
.dashboard-trend-custom-error {
  width: 100%;
  text-align: right;
  color: var(--red);
  font-size: 12px;
}
.dashboard-trend-grid {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dashboard-trend-card {
  overflow: visible;
  padding: 0 16px 16px;
}
.dashboard-trend-card .glass-card-header {
  padding: 20px 4px 8px;
  align-items: flex-start;
}
.dashboard-trend-unit {
  display: block;
  margin-top: 4px;
  color: var(--white-38);
  font-size: 12px;
}
.dashboard-trend-summary {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.dashboard-trend-wrap {
  position: relative;
  height: 192px;
  width: 100%;
}
.dashboard-trend-wrap canvas {
  cursor: default;
  touch-action: pan-y;
  display: block;
  width: 100%;
  height: 100%;
}
.dashboard-trend-legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--white-38);
}
.dashboard-trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dashboard-trend-legend i {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: #3b82f6;
}
.dashboard-trend-legend .download {
  background: #3b9cff;
}
.dashboard-trend-legend .upload {
  background: #a78bfa;
}
.dashboard-trend-legend .traffic {
  background: #10b981;
}
.dashboard-chart-tooltip {
  transform: none;
  position: absolute;
  z-index: 5;
  min-width: 132px;
  max-width: 230px;
  padding: 11px 13px;
  border: 1px solid #3e4655;
  border-radius: 8px;
  background: #202632;
  color: var(--white-87);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--page-shadow);
}
.dashboard-chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 5px;
}
.dashboard-insights-grid,
.dashboard-site-status {
  position: relative;
  z-index: 1;
}
.dashboard-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.dashboard-insight-card {
  padding: 17px 20px;
  background: var(--panel-soft);
}
.dashboard-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dashboard-insight-head h2 {
  font-size: 12px;
  font-weight: 500;
  color: var(--white-87);
}
.dashboard-health-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--white-38);
}
.dashboard-insight-card p {
  margin-top: 7px;
  color: var(--white-38);
  font-size: 12px;
}
.dashboard-site-status table {
  min-width: 760px;
}
.dashboard-site-status td {
  font-size: 12px;
}
.dashboard-speed {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dashboard-speed .in {
  color: var(--purple);
}
.dashboard-speed .out {
  color: var(--blue);
}

/* Sites */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.toolbar-info {
  flex-shrink: 0;
  color: var(--white-38);
  font-size: 12px;
}
.toolbar-info strong {
  font-weight: 500;
  color: var(--white-87);
}
.sites-search {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  max-width: 370px;
  margin-left: auto;
}
.sites-search input {
  width: 100%;
  height: 40px;
  padding: 9px 12px 9px 38px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  outline: 0;
  background: var(--panel);
  color: var(--white);
  font-size: 12px;
}
.sites-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.sites-search input::placeholder {
  color: var(--white-38);
}
.sites-search svg {
  position: absolute;
  left: 13px;
  top: 12px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--white-38);
  stroke-width: 1.5;
}
.sites-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.site-card {
  position: relative;
  padding: 23px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.site-card:hover {
  border-color: #394455;
  box-shadow: var(--page-shadow);
}
.site-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 20px;
}
.site-heading {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}
.site-heading-content {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.site-name {
  max-width: 100%;
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.site-drag-handle {
  width: 16px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-left: -7px;
  color: #4b5463;
  cursor: grab;
  touch-action: none;
}
.site-drag-handle:hover {
  color: var(--white-60);
}
.site-drag-handle svg {
  width: 15px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}
.site-card-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}
.site-latency-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  color: var(--white-38);
  font-size: 12px;
}
.site-latency-line > .status-led {
  display: none;
}
.site-latency {
  font-weight: 500;
}
.site-latency.good {
  color: var(--green);
}
.site-latency.warn {
  color: var(--orange);
}
.site-latency.bad {
  color: var(--red);
}
.site-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.site-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-width: 0;
  font-size: 12px;
}
.site-row-value {
  font-size: 12px;
  font-weight: 400;
  color: var(--white-60);
  overflow-wrap: anywhere;
  text-align: right;
}
.site-row-label {
  flex-shrink: 0;
  color: var(--white-38);
  font-size: 12px;
}
.site-row > .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--white-60);
}
.site-access-row {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--panel-soft);
}
.site-access-row .site-row-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}
.site-access-value {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.site-access-address {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  text-overflow: clip;
  white-space: nowrap;
  color: #adbed6;
  font-size: 12px;
}
.site-access-address.is-hidden {
  letter-spacing: 0.2em;
  color: var(--white-38);
}
.site-access-value .icon-button {
  width: 27px;
  height: 27px;
}
.site-access-value svg {
  width: 14px;
  height: 14px;
}
.site-actions {
  display: flex;
  gap: 7px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--glass-border);
}
.site-actions .btn-ghost {
  min-height: 33px;
  padding: 5px 12px;
  font-size: 12px;
  background: transparent;
}
.site-actions .btn-ghost[data-site-action="edit"] {
  color: var(--blue);
  background: var(--blue-dim);
  border-color: transparent;
}
.site-actions .danger {
  margin-left: auto;
  border-color: transparent;
}
.progress-wrap {
  margin-top: 3px;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--white-60);
}
.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-active);
}
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--button-blue);
}
.progress-fill.warn {
  background: var(--orange);
}
.progress-fill.danger {
  background: var(--red);
}
.site-card.is-dragging {
  z-index: 1800;
  pointer-events: none;
  opacity: 0.92;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  border-color: var(--blue);
}
.site-card-placeholder {
  position: relative;
  border: 1px dashed #506686;
  border-radius: var(--ui-radius);
  background: var(--blue-dim);
}
.site-card-placeholder::after {
  content: "放到这里";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 12px;
}
.sites-grid.is-saving-order {
  pointer-events: none;
  opacity: 0.7;
}
body.is-site-dragging {
  cursor: grabbing;
  user-select: none;
}
.site-card.sorting-source {
  opacity: 0.4;
}
.site-card.sort-target-before {
  box-shadow: 0 -3px 0 var(--blue);
}
.site-card.sort-target-after {
  box-shadow: 0 3px 0 var(--blue);
}
.site-sort-ghost {
  position: fixed;
  z-index: 1800;
  pointer-events: none;
  opacity: 0.8;
}

/* Modal and site editor */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(7px);
}
.modal-overlay.active {
  display: flex;
}
.modal {
  outline: none;
  width: min(500px, 100%);
  max-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #363e4b;
  border-radius: max(var(--ui-radius), 12px);
  background: var(--panel);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.5);
  animation: fadeUp 0.2s var(--ease);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  min-height: 77px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.modal-close {
  background: var(--surface);
  font-size: 13px;
}
.modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 28px;
}
.modal-footer {
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 17px 28px;
  border-top: 1px solid var(--glass-border);
  background: var(--panel-soft);
}
.modal-footer .btn-modal {
  min-width: 90px;
}
.modal.site-config-modal {
  width: min(1000px, 100%);
  height: min(760px, calc(100dvh - 56px));
}
.site-config-modal .modal-body {
  flex: 1;
  padding: 0 28px 26px;
}
.site-modal-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--panel);
}
.site-modal-tab {
  position: relative;
  flex-shrink: 0;
  min-height: 57px;
  padding: 16px 2px;
  border-bottom: 2px solid transparent;
  color: var(--white-38);
  font-size: 12px;
  white-space: nowrap;
}
.site-modal-tab:hover {
  color: var(--white-87);
}
.site-modal-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}
.site-modal-panel {
  display: none;
}
.site-modal-panel.active {
  display: block;
}
#site-panel-basic.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
}
#site-panel-basic > .form-group:first-child {
  grid-column: 1 / -1;
}
.site-form-wide {
  grid-column: 1 / -1;
}
.site-config-modal .form-help {
  font-size: 12px;
}
.site-config-modal .form-group > label {
  font-size: 12px;
}
.upstream-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.upstream-lines-head label {
  color: var(--white-87);
  font-size: 13px;
  font-weight: 500;
}
.upstream-lines-head .form-help {
  margin-top: 3px;
}
.upstream-lines-buttons {
  display: flex;
  gap: 8px;
}
.upstream-lines-buttons > button {
  min-height: 34px;
  height: 36px;
  padding: 6px 12px;
  font-size: 12px;
}
.upstream-line {
  display: grid;
  grid-template-columns:
    44px minmax(100px, 0.7fr) 90px minmax(150px, 1.5fr)
    76px 60px 88px;
  align-items: end;
  gap: 10px;
  padding: 15px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: var(--panel-soft);
}
#m-failover-lines .upstream-line {
  margin-top: 9px;
}
.upstream-line-field {
  min-width: 0;
}
.upstream-line-field::before,
.upstream-line-latency::before,
.upstream-line-actions::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 8px;
  color: var(--white-38);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}
.upstream-line .form-input,
.upstream-line .form-select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.upstream-line .form-select {
  padding-right: 25px;
  background-position: right 7px center;
}
.upstream-line-enabled {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  color: var(--white-60);
  font-size: 12px;
}
.upstream-line-latency {
  padding-bottom: 9px;
  text-align: center;
  color: var(--white-38);
  font-size: 12px;
  white-space: nowrap;
}
.site-config-modal .upstream-line-latency.good {
  color: var(--green);
}
.site-config-modal .upstream-line-latency.warn {
  color: var(--orange);
}
.site-config-modal .upstream-line-latency.bad {
  color: var(--red);
}
.upstream-line-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-height: 38px;
}
.upstream-line-actions::before {
  position: absolute;
  right: 0;
  bottom: 100%;
}
.upstream-line-actions .icon-button {
  width: 28px;
  height: 32px;
}
.upstream-line-actions .icon-button svg {
  width: 14px;
  height: 14px;
}
.upstream-line-primary-note {
  color: var(--blue);
  background: var(--blue-dim);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
}
.upstream-line-port {
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.upstream-line-port::-webkit-inner-spin-button,
#m-port::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.form-list-row.upstream-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 58px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.upstream-header-row legend {
  grid-column: 1 / -1;
  color: var(--white-38);
  font-size: 12px;
  margin-bottom: 4px;
}
.upstream-header-row .form-row-action {
  padding: 7px;
  white-space: nowrap;
}
.upstream-header-row label {
  min-width: 0;
}
.upstream-header-row .form-help {
  grid-column: 1 / -1;
}
.upstream-header-add {
  margin-top: 5px;
  min-height: 33px;
  padding: 6px 12px;
}
.site-dynamic-card {
  padding: 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--ui-radius);
  background: var(--panel-soft);
}
.site-feature-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.site-feature-heading label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 7px;
}
.site-feature-badge {
  color: var(--blue);
  background: var(--blue-dim);
  border-color: transparent;
}
.site-dynamic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 18px;
  border-block: 1px solid var(--glass-border);
}
.site-dynamic-toggle {
  color: var(--white-87);
  font-size: 12px;
}
.site-dynamic-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white-38);
  font-size: 12px;
  min-width: 0;
}
.site-dynamic-profile select {
  width: 240px;
}
.site-dynamic-help {
  margin-top: 14px;
  color: var(--white-60);
  font-size: 12px;
  line-height: 1.8;
}
.site-dynamic-extreme {
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #614b30;
  border-radius: 8px;
  background: var(--orange-dim);
}
.site-dynamic-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--orange);
  font-size: 12px;
}
.site-dynamic-advanced {
  margin-top: 22px;
  border-top: 1px solid var(--glass-border);
}
.site-dynamic-advanced summary,
.settings-advanced-details summary {
  padding-block: 16px;
  cursor: pointer;
  font-size: 12px;
  color: var(--white-60);
}
.site-dynamic-advanced-body {
  padding-bottom: 4px;
}
.site-dynamic-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 0 10px;
  font-size: 12px;
}
.site-dynamic-rules-head button {
  min-height: 32px;
  font-size: 12px;
  padding: 5px 10px;
}
.m-dynamic-rule-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 60px;
  gap: 10px;
  margin-bottom: 8px;
}
.site-advanced-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--ui-radius);
  overflow: hidden;
}
.site-advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 15px 20px;
  background: var(--panel-soft);
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.site-advanced-summary::-webkit-details-marker {
  display: none;
}
.site-advanced-summary svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.site-advanced-card[open] .site-advanced-summary svg {
  transform: rotate(180deg);
}
.site-advanced-body {
  padding: 22px;
  border-top: 1px solid var(--glass-border);
}
.site-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  align-items: start;
}
.site-settings-grid > .cache-limit-group {
  grid-column: 1 / -1;
  padding: 20px;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: var(--panel-soft);
}
.site-cache-options {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 20px;
}
.site-cache-options .form-group {
  margin: 0;
}
.site-cache-options label {
  font-size: 12px;
}
.site-cache-rules-group {
  min-width: 0;
  border: 1px solid var(--glass-border);
  border-radius: 7px;
}
.site-cache-rules-group[hidden] {
  display: none !important;
}
.site-cache-rules-group summary {
  padding: 12px;
  color: var(--white-60);
  font-size: 12px;
  cursor: pointer;
}
.site-cache-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 24px;
}
.site-cache-panel-heading h3 {
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
}
.site-cache-panel-heading p {
  color: var(--white-38);
  font-size: 12px;
  line-height: 1.8;
}
.site-cache-rules-body {
  padding: 0 12px 12px;
}
.cache-limit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 105px;
  align-items: center;
  gap: 12px;
}
.cache-limit-grid label {
  display: block;
  font-size: 12px;
  color: var(--white-60);
}

/* Settings and utility pages */
.settings-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
}
.settings-section-nav {
  position: sticky;
  top: 104px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 18px;
  border-right: 1px solid var(--glass-border);
}
.settings-section-nav > span {
  margin: 4px 10px 6px;
  color: var(--white-38);
  font-size: 12px;
  letter-spacing: 0.15em;
}
.settings-section-nav > strong {
  margin: 0 10px 24px;
  color: var(--white-87);
  font-size: 16px;
  font-weight: 500;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--white-60);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
.settings-nav-item:hover {
  background: var(--surface);
  color: var(--white);
}
.settings-nav-item.active {
  background: var(--blue-dim);
  color: var(--blue);
}
.settings-content {
  min-width: 0;
  display: grid;
  gap: 18px;
}
.settings-panel {
  padding: 25px 28px;
  overflow-wrap: anywhere;
}
.settings-panel > header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.settings-panel > header > span {
  display: block;
  width: 100%;
  color: var(--white-38);
  font-size: 12px;
  letter-spacing: 0.13em;
}
.settings-panel h2 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.settings-panel > header > b {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  color: var(--white-38);
  font-size: 12px;
  font-weight: 400;
}
.settings-panel-help {
  margin-bottom: 20px;
  max-width: 680px;
  color: var(--white-60);
  font-size: 12px;
  line-height: 1.85;
}
.settings-label {
  display: block;
  margin-bottom: 9px;
  font-size: 12px;
  color: var(--white-60);
}
.settings-system-fields {
  margin-top: 26px;
}
.settings-grid,
.settings-two-column,
.settings-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.settings-field {
  min-width: 0;
  display: block;
}
.settings-field > div {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.settings-field > div > em {
  position: absolute;
  right: 14px;
  color: var(--white-38);
  font-size: 12px;
  font-style: normal;
  pointer-events: none;
}
.settings-field input[type="number"] {
  padding-right: 50px;
}
.settings-range {
  display: grid;
  gap: 12px;
  font-size: 12px;
}
.settings-range > div {
  display: flex;
  align-items: center;
  gap: 20px;
}
.settings-range output {
  white-space: nowrap;
  color: var(--blue);
}
.settings-choice {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--panel-soft);
}
.settings-choice button {
  min-height: 34px;
  padding: 7px 15px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--white-60);
  font-size: 12px;
}
.settings-choice button:hover {
  color: var(--white);
}
.settings-choice button.active {
  border-color: #3b4860;
  background: #222d40;
  color: #b8d3ff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 15px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel-soft);
}
.settings-check:has(input:checked) {
  border-color: #334663;
  background: var(--blue-dim);
}
.settings-check input {
  margin-top: 3px;
}
.settings-check-copy {
  min-width: 0;
}
.settings-check strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.settings-check small {
  display: block;
  margin-top: 4px;
  color: var(--white-38);
  font-size: 12px;
  line-height: 1.8;
}
.settings-panel > .settings-check {
  margin-top: 16px;
}
.settings-panel > .settings-grid + .settings-grid,
.settings-panel > .settings-grid + .settings-check-grid {
  margin-top: 20px;
}
.settings-save-bar,
.tls-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.settings-save-bar {
  padding: 16px 0 0;
}
.settings-loading {
  padding: 38px;
  border: 1px dashed var(--glass-border);
  border-radius: var(--ui-radius);
  color: var(--white-38);
  text-align: center;
  font-size: 12px;
}
.settings-advanced-details {
  margin-top: 18px;
  padding-top: 2px;
  border-top: 1px solid var(--glass-border);
}
.global-settings-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--white-60);
}
.backup-warning,
.telegram-secret-warning {
  padding: 13px 16px;
  margin-top: 18px;
  border-left: 2px solid var(--orange);
  border-radius: 0 6px 6px 0;
  background: var(--orange-dim);
  color: var(--orange);
  font-size: 12px;
  line-height: 1.85;
}
.backup-warning.danger {
  border-color: var(--red);
  background: var(--red-dim);
  color: var(--red);
}
.backup-confirm-field {
  margin-top: 22px;
}
.backup-restore-danger {
  border-color: #443036;
}
.backup-file-input {
  font-size: 12px;
  padding: 6px;
}
.backup-file-input::file-selector-button {
  padding: 6px 10px;
  margin-right: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  background: var(--panel-raised);
  color: var(--white-87);
  font: inherit;
  cursor: pointer;
}
.telegram-report-layout {
  min-width: 0;
}
.telegram-bot-card + .telegram-bot-card {
  margin-top: 0;
}
.telegram-bot-status {
  color: var(--white-60);
  font-size: 12px;
  padding-top: 3px;
}
.telegram-bot-status[data-state="online"] {
  color: var(--green, #66d0a0);
}
.telegram-bot-status[data-state="error"] {
  color: var(--red, #ff8e95);
}
.telegram-bot-connection:empty {
  display: none;
}
.telegram-bot-connection {
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.telegram-url-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
}
.telegram-url-row input {
  flex: 1;
  min-width: 0;
}
.telegram-url-row button {
  flex-shrink: 0;
}
.telegram-bot-help {
  display: grid;
  gap: 10px;
  color: var(--white-60);
  font-size: 13px;
  line-height: 1.7;
  padding-top: 14px;
}
.telegram-bot-actions {
  margin-top: 0;
}
@media (max-width: 600px) {
  .telegram-url-row {
    flex-direction: column;
  }
  .telegram-url-row button,
  .telegram-bot-card .telegram-switch {
    min-height: 44px;
  }
  .telegram-bot-card input,
  .telegram-bot-card select {
    font-size: 16px;
    min-height: 46px;
  }
}
.telegram-report-card {
  padding: 26px;
}
.telegram-report-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.telegram-report-card-head h2 {
  font-size: 17px;
  font-weight: 500;
}
.telegram-report-card-head p {
  margin-top: 7px;
  color: var(--white-60);
  font-size: 12px;
}
.telegram-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
}
.telegram-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.telegram-switch span {
  position: relative;
  display: block;
  width: 32px;
  height: 19px;
  border: 1px solid #444c58;
  border-radius: 20px;
  background: #292f39;
  transition: background 0.16s ease;
}
.telegram-switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #a6afbd;
  transition: transform 0.16s ease;
}
.telegram-switch input:checked + span {
  background: var(--button-blue);
  border-color: var(--button-blue);
}
.telegram-switch input:checked + span::after {
  transform: translateX(13px);
  background: #fff;
}
.telegram-switch input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}
.telegram-switch strong {
  font-size: 12px;
  color: var(--white-60);
  font-weight: 400;
}
.telegram-report-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.telegram-field {
  min-width: 0;
}
/* iOS time controls have an intrinsic width; constrain both the control and
   WebKit's internal editor to the grid cell, including borders and padding. */
.telegram-field input[type="time"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.telegram-field input[type="time"]::-webkit-date-and-time-value {
  min-width: 0;
  min-height: 20px;
  text-align: left;
}
.telegram-field input[type="time"]::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}
.telegram-field-wide {
  grid-column: 1 / -1;
}
.telegram-report-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}
.telegram-report-details {
  border-top: 1px solid var(--glass-border);
  margin-top: 24px;
  padding-top: 16px;
}
.telegram-report-details > summary {
  cursor: pointer;
  color: var(--white-60);
  font-size: 12px;
}
.telegram-report-details[open] > summary {
  margin-bottom: 20px;
}
.telegram-report-items {
  display: grid;
  gap: 18px;
}
.telegram-report-items > div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.telegram-report-items strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.telegram-report-items small {
  display: block;
  margin-top: 5px;
  color: var(--white-38);
  font-size: 12px;
  line-height: 1.8;
}

/* Account */
.account-page {
  display: grid;
  gap: 22px;
  max-width: 900px;
  margin: 0 auto;
}
.account-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 30px;
  background:
    linear-gradient(110deg, rgba(95, 135, 192, 0.06), transparent 60%),
    var(--panel);
}
.account-profile-main {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.account-profile-main > div {
  min-width: 0;
}
.account-profile-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border: 1px solid #3b4961;
  border-radius: 18px;
  background: #202c41;
  color: #aac8f6;
  font-size: 26px;
}
.account-eyebrow {
  color: var(--white-38);
  font-size: 12px;
}
.account-profile-main h2 {
  margin-top: 2px;
  font-size: 24px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.account-profile-main p {
  margin-top: 3px;
  color: var(--white-60);
  font-size: 12px;
}
.account-profile-meta {
  display: grid;
  gap: 12px;
  font-size: 12px;
}
.account-profile-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 28px;
}
.account-profile-meta dt {
  color: var(--white-38);
}
.account-profile-meta dd {
  color: var(--white-87);
}
.account-settings-card {
  padding: 30px;
}
.account-card-head {
  margin-bottom: 26px;
}
.account-card-head h2,
.account-session-card h2 {
  font-size: 17px;
  font-weight: 500;
}
.account-card-head p,
.account-session-card p {
  margin-top: 7px;
  color: var(--white-60);
  font-size: 12px;
  line-height: 1.8;
}
.account-password-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.account-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 22px;
  border-top: 1px solid var(--glass-border);
}
.account-session-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 30px;
  background: var(--panel-soft);
}
.account-session-card h2 {
  font-size: 14px;
}
.account-session-card p {
  max-width: 500px;
  margin-top: 0;
}
.account-logout-button {
  flex-shrink: 0;
}

/* Request logs */
.request-log-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 22px 24px;
  margin-bottom: 20px;
}
.request-log-search-row {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  align-items: end;
  gap: 20px;
  grid-column: 1 / -1;
}
.request-log-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  min-width: 0;
}
.request-log-date-field,
.request-log-search-field {
  min-width: 0;
}
.request-log-date-field input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
.request-log-date-field input::-webkit-date-and-time-value {
  min-height: 20px;
  text-align: left;
}
.request-log-date-field input::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}
.request-log-date-field > span {
  font-size: 12px;
}
.request-log-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  color: var(--white-38);
  font-size: 12px;
}
.request-log-search-field {
  position: relative;
}
.request-log-search-field svg {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--white-38);
  stroke-width: 1.6;
}
.request-log-search-field input {
  padding-right: 40px;
  font-size: 12px;
}
.request-log-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.request-log-filter-label {
  color: var(--white-60);
  font-size: 12px;
  white-space: nowrap;
}
.request-log-filter-select {
  min-height: 40px;
  font-size: 12px;
}
.request-log-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  grid-column: 1 / -1;
}
.request-log-action {
  min-height: 32px;
  padding: 5px 10px;
  background: none;
  font-size: 12px;
}
.request-log-action svg {
  width: 13px;
  height: 13px;
}
.request-log-action.danger {
  border-color: transparent;
  color: var(--white-60);
}
.request-log-action.danger:hover {
  color: var(--red);
}
.request-log-summary {
  margin-left: auto;
  color: var(--white-38);
  font-size: 12px;
}
.request-log-table-card {
  overflow: hidden;
}
.request-log-table-scroll {
  width: 100%;
  max-height: 680px;
  overflow: auto;
}
.request-log-table {
  min-width: 1080px;
  table-layout: fixed;
}
.request-log-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-soft);
}
.request-log-table th,
.request-log-table td {
  padding: 13px 16px;
}
.request-log-table td {
  font-size: 12px;
  vertical-align: top;
}
.request-log-col-node {
  width: 115px;
}
.request-log-col-category {
  width: 105px;
}
.request-log-col-status {
  width: 70px;
}
.request-log-col-backend {
  width: 200px;
}
.request-log-col-ip {
  width: 160px;
}
.request-log-table col.request-log-col-ua {
  width: 220px;
}
.request-log-table col.request-log-col-upstream-ua {
  width: 220px;
}
.request-log-col-time {
  width: 110px;
}
.request-log-node,
.request-log-backend {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request-log-region {
  display: block;
  margin-top: 2px;
  color: var(--white-38);
  font-size: 12px;
}
.request-log-ua,
.request-log-backend {
  color: var(--white-60);
}
.request-log-category {
  font-size: 12px;
  color: var(--white-60);
}
.request-log-time {
  color: var(--white-38);
  font-size: 12px;
}
.request-log-status {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 4px;
  font: 10px/1.7 monospace;
}
.request-log-status-ok {
  color: var(--green);
  background: var(--green-dim);
}
.request-log-status-client {
  color: var(--orange);
  background: var(--orange-dim);
}
.request-log-status-server {
  color: var(--red);
  background: var(--red-dim);
}
.request-log-ua {
  display: block;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}
.request-log-table td[data-log-field="ua"],
.request-log-table td[data-log-field="upstream-ua"] {
  overflow: visible;
}
.request-log-table th[data-log-field="timeline"],
.request-log-table td[data-log-field="timeline"] {
  text-align: right;
}
.request-log-table th,
.request-log-table td {
  overflow-wrap: anywhere;
}
.request-log-category,
.request-log-node,
.request-log-status {
  white-space: nowrap;
}
.request-log-empty,
.request-log-error {
  padding: 60px 20px;
  color: var(--white-38);
  text-align: center;
  font-size: 12px;
}
.request-log-error {
  color: var(--red);
}
.log-detail-row > td {
  padding: 0 16px 16px;
}
.log-detail-card {
  padding: 18px 22px;
  border: 1px solid #33405a;
  border-radius: 8px;
  background: var(--panel-soft);
}
.log-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}
.log-detail-path-badge {
  min-width: 0;
  font-family: var(--font-ui);
  color: var(--blue);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.log-detail-copy-btn {
  flex-shrink: 0;
  color: var(--white-60);
  font-size: 12px;
}
.log-detail-copy-btn:hover {
  color: var(--blue);
}
.log-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.log-detail-item {
  min-width: 0;
}
.log-detail-label {
  display: block;
  margin-bottom: 5px;
  color: var(--white-38);
  font-size: 12px;
}
.log-detail-val {
  font-family: var(--font-ui);
  color: var(--white-87);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Diagnostics and retained traffic views */
.diag-toolbar,
.controls-row,
.traffic-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.diag-toolbar .form-select {
  flex: 1;
  max-width: 400px;
}
.diag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.diag-card {
  padding: 23px;
}
.diag-card-wide {
  grid-column: 1 / -1;
}
.diag-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.diag-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-dim);
}
.diag-icon.green {
  color: var(--green);
  background: var(--green-dim);
}
.diag-icon.orange {
  color: var(--orange);
  background: var(--orange-dim);
}
.diag-title {
  font-size: 14px;
  font-weight: 500;
}
.diag-subtitle {
  font-size: 12px;
  color: var(--white-38);
}
.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--glass-border);
  font-size: 12px;
}
.diag-key {
  color: var(--white-38);
  flex-shrink: 0;
}
.diag-val {
  color: var(--white-87);
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}
.diag-wrap {
  word-break: break-word;
}
.diag-val.good {
  color: var(--green);
}
.diag-val.bad {
  color: var(--red);
}
.diag-val.warn {
  color: var(--orange);
}
.diag-empty {
  padding: 70px 15px;
  color: var(--white-38);
  text-align: center;
  font-size: 12px;
}
.diag-note-list {
  margin-top: 16px;
}
.diag-note-item {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--white-60);
  font-size: 12px;
}
.traffic-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.total-card {
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--ui-radius);
  background: var(--panel);
}
.total-label {
  font-size: 12px;
  color: var(--white-60);
}
.total-value {
  margin-top: 10px;
  font-size: 26px;
}
.total-delta,
.traffic-range-note {
  color: var(--white-38);
  font-size: 12px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  padding: 20px;
}
.chart-wrap {
  height: 280px;
  padding: 20px;
}
.chart-wrap canvas {
  width: 100%;
  height: 100%;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--white-60);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

/* Feedback */
#toast-container {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
  pointer-events: none;
}
.toast,
html[data-theme="light"] .toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border: 1px solid #3b4351;
  border-radius: 10px;
  background: var(--panel-raised);
  color: var(--white-87);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  font-size: 12px;
  pointer-events: auto;
  animation: toastIn 0.2s ease both;
}
.toast svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.toast.success {
  color: var(--green);
}
.toast.info {
  color: var(--blue);
}
.toast.error,
html[data-theme="light"] .toast.error {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 30%, var(--glass-border));
}

/* Responsive layouts */
@media (min-width: 1680px) {
  .sites-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .main {
    padding-inline: 56px;
  }
  .app-header {
    padding-inline: 56px;
  }
}
@media (max-width: 1200px) {
  .main {
    padding: 30px 26px 20px;
  }
  .app-header {
    padding-inline: 26px;
  }
  .stats-row {
    gap: 10px;
  }
  .stat-card {
    padding: 16px;
    gap: 15px 2px;
  }
  .stat-title {
    font-size: 12px;
  }
  .stat-icon-wrap {
    width: 27px;
    height: 27px;
  }
  .settings-layout {
    grid-template-columns: 154px minmax(0, 1fr);
    gap: 24px;
  }
  .settings-section-nav {
    padding-right: 12px;
  }
  .settings-section-nav > strong {
    font-size: 14px;
  }
  .telegram-report-layout {
    grid-template-columns: 1fr;
  }
  .telegram-report-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth-story {
    padding-right: 40px;
  }
  .auth-form-area {
    padding-left: 48px;
    padding-right: 24px;
  }
  .auth-form-footer {
    left: 48px;
    right: 24px;
  }
}
@media (max-width: 1024px) {
  .dashboard-trend-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-trend-wrap {
    height: 205px;
  }
  .dashboard-trend-toolbar {
    align-items: flex-start;
  }
  .dashboard-trend-controls {
    justify-content: flex-start;
  }
  .sites-grid {
    grid-template-columns: 1fr;
  }
  .upstream-line {
    grid-template-columns: 42px minmax(95px, 0.7fr) 85px minmax(140px, 1fr) 72px;
  }
  .upstream-line-latency {
    grid-column: 2 / 4;
    text-align: left;
    padding-bottom: 0;
  }
  .upstream-line-latency::before {
    display: inline;
    margin-right: 10px;
  }
  .upstream-line-actions {
    grid-column: 4 / 6;
    min-height: 28px;
  }
  .upstream-line-actions::before {
    display: none;
  }
  .request-log-search-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .request-log-search-field {
    grid-column: 1 / -1;
  }
  .account-profile-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .account-profile-meta {
    width: 100%;
    padding-top: 18px;
    border-top: 1px solid var(--glass-border);
  }
}
@media (max-width: 768px) {
  :root {
    --nav-h: 64px;
  }
  html {
    scroll-padding-top: 80px;
  }
  .app-header {
    display: flex;
    margin-left: 0;
    min-height: 64px;
    padding: 14px 18px;
  }
  .sidebar {
    display: flex;
    visibility: hidden;
    width: 254px;
    padding: 24px 18px 18px;
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    z-index: 200;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.35);
  }
  #app-shell.sidebar-expanded .sidebar {
    transform: translateX(0);
    visibility: visible;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  #app-shell.sidebar-expanded .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-brand {
    padding-bottom: 28px;
  }
  .sidebar-brand-name {
    font-size: 22px;
  }
  .sidebar-nav .topnav-link {
    min-height: 46px;
  }
  .sidebar-account {
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar-toggle {
    width: 34px;
    height: 34px;
  }
  .sidebar-toggle svg {
    width: 20px;
    height: 20px;
  }
  .app-header-copy h1 {
    font-size: 13px;
  }
  .header-workspace-label {
    display: none;
  }
  .app-header-actions {
    margin-left: auto;
  }
  .main {
    margin-left: 0;
    padding: 28px 20px 20px;
  }
  .section-title {
    font-size: 25px;
  }
  .section-sub {
    font-size: 12px;
  }
  .eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
  }
  .dashboard-page-head {
    gap: 14px;
    margin-bottom: 16px;
  }
  .dashboard-page-meta .mono {
    display: none;
  }
  .live-indicator {
    font-size: 12px;
    padding: 4px 7px;
    white-space: nowrap;
  }
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 28px;
  }
  .stat-card {
    padding: 18px;
    gap: 12px;
  }
  .stat-title {
    font-size: 12px;
  }
  .stat-number {
    font-size: 29px;
  }
  .stat-card:last-child {
    grid-column: 1 / -1;
    grid-template-columns: 30px 1fr auto;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 12px;
  }
  .stat-card:last-child .stat-icon-wrap {
    grid-column: 1;
    grid-row: 1;
  }
  .stat-card:last-child .stat-title {
    grid-column: 2;
    grid-row: 1;
  }
  .stat-card:last-child .stat-number {
    grid-column: 3;
    grid-row: 1;
    font-size: 23px;
  }
  .dashboard-trend-toolbar {
    gap: 16px;
  }
  .dashboard-trend-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .dashboard-trend-control {
    display: block;
    min-width: 0;
  }
  .dashboard-trend-control > label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
  }
  .dashboard-trend-controls .form-select {
    width: 100%;
    min-height: 44px;
  }
  .dashboard-trend-custom {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
  }
  .dashboard-trend-custom-separator {
    display: none;
  }
  .dashboard-trend-custom-error {
    text-align: left;
  }
  .dashboard-trend-grid {
    gap: 16px;
  }
  .dashboard-trend-card {
    padding-inline: 17px;
  }
  .dashboard-insights-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .dashboard-insight-card {
    padding: 17px 20px;
  }
  .sites-toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .sites-search {
    max-width: none;
    flex-basis: 100%;
    order: 3;
  }
  .btn-test-all {
    margin-left: auto;
  }
  .sites-toolbar .toolbar-info {
    order: 4;
    width: 100%;
    text-align: right;
  }
  .sites-grid {
    gap: 16px;
  }
  .site-card {
    padding: 21px;
  }
  .site-actions {
    gap: 7px;
  }
  .site-actions .btn-ghost {
    min-height: 38px;
    padding-inline: 13px;
  }
  .settings-layout {
    display: block;
    width: 100%;
  }
  .settings-section-nav {
    position: static;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    margin: -4px 0 24px;
    padding: 0 0 12px;
    gap: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--glass-border);
    scrollbar-width: none;
  }
  .settings-section-nav > span,
  .settings-section-nav > strong {
    display: none;
  }
  .settings-nav-item {
    flex: 0 0 auto;
    min-height: 37px;
    padding: 8px 13px;
    font-size: 12px;
  }
  .settings-content {
    gap: 16px;
    width: 100%;
  }
  .settings-panel {
    padding: 22px 20px;
  }
  .settings-panel > header {
    gap: 7px;
  }
  .settings-panel h2 {
    font-size: 16px;
  }
  .settings-panel > header > b {
    font-size: 12px;
  }
  .settings-panel-help {
    font-size: 12px;
  }
  .settings-grid,
  .settings-two-column,
  .settings-check-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .settings-choice {
    display: flex;
    width: 100%;
  }
  .settings-choice button {
    flex: 1;
    min-width: 0;
    padding: 8px;
    font-size: 12px;
  }
  .settings-save-bar > button {
    flex: 1;
  }
  .tls-settings-actions {
    flex-wrap: wrap;
  }
  .tls-settings-actions > button {
    flex: 1;
  }
  .settings-check {
    min-height: 48px;
  }
  .telegram-report-card {
    padding: 22px 20px;
  }
  .telegram-report-card-head {
    flex-wrap: wrap;
    gap: 14px;
  }
  .telegram-report-form-grid {
    grid-template-columns: 1fr;
  }
  .telegram-report-items {
    grid-template-columns: 1fr;
  }
  .telegram-report-actions > button {
    flex: 1;
  }
  .telegram-switch strong {
    font-size: 12px;
  }
  .request-log-controls {
    padding: 19px 17px;
    gap: 16px 12px;
  }
  .request-log-search-row {
    gap: 16px;
  }
  .request-log-date-range {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .request-log-date-field {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .request-log-date-field > span {
    margin-bottom: 0;
  }
  .request-log-date-separator {
    display: none;
  }
  .request-log-date-field input,
  .request-log-search-field input,
  .request-log-filter-select {
    min-height: 46px;
    font-size: 16px;
  }
  .request-log-date-field input {
    padding-inline: 10px;
  }
  .request-log-filter-row {
    display: block;
  }
  .request-log-filter-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
  }
  .request-log-filter-select {
    width: 100%;
  }
  .request-log-summary {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
    margin-left: 0;
  }
  .request-log-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 6px;
  }
  .request-log-action {
    min-height: 44px;
    gap: 6px;
    padding-inline: 4px;
    white-space: nowrap;
  }
  .log-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .account-profile-card {
    padding: 24px;
  }
  .account-profile-avatar {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    font-size: 22px;
  }
  .account-profile-main {
    gap: 16px;
  }
  .account-profile-main h2 {
    font-size: 22px;
  }
  .account-settings-card {
    padding: 24px;
  }
  .account-password-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .account-session-card {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
    gap: 16px;
  }
  .account-form-actions > button {
    width: 100%;
  }
  .account-logout-button {
    width: 100%;
  }
  .diag-grid {
    grid-template-columns: 1fr;
  }
  .diag-card {
    padding: 20px;
  }
  .diag-toolbar .form-select {
    max-width: none;
  }
  .diag-toolbar {
    gap: 8px;
  }
  .traffic-totals {
    grid-template-columns: 1fr;
  }
  .modal-overlay {
    padding: 12px;
  }
  .modal {
    max-height: calc(100dvh - 24px);
  }
  .modal.site-config-modal {
    width: 100%;
    height: calc(100dvh - 24px);
  }
  .modal-header {
    min-height: 64px;
    padding: 15px 20px;
  }
  .modal-header h3 {
    font-size: 17px;
  }
  .modal-body {
    padding: 20px;
  }
  .site-config-modal .modal-body {
    padding: 0 20px 22px;
  }
  .modal-footer {
    padding: 14px 20px;
  }
  .modal-footer .btn-modal {
    flex: 1;
    min-height: 44px;
  }
  .site-modal-tabs {
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 22px;
  }
  .site-modal-tab {
    min-height: 52px;
    font-size: 12px;
  }
  .site-modal-tab:focus-visible {
    outline-offset: -3px;
  }
  #site-panel-basic.active {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .upstream-lines-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .upstream-lines-buttons {
    width: 100%;
  }
  .upstream-lines-buttons > button {
    flex: 1;
    min-height: 38px;
  }
  .upstream-line {
    grid-template-columns: minmax(0, 1fr) 90px;
    grid-template-areas: "enabled actions" "name name" "scheme port" "address address" "latency latency";
    gap: 12px;
    padding: 16px;
  }
  .upstream-line-enabled {
    grid-area: enabled;
    min-height: 28px;
    font-size: 12px;
  }
  .upstream-line-name-field {
    grid-area: name;
  }
  .upstream-line-scheme-field {
    grid-area: scheme;
  }
  .upstream-line-address-field {
    grid-area: address;
  }
  .upstream-line-port-field {
    grid-area: port;
  }
  .upstream-line-latency {
    grid-area: latency;
    text-align: left;
  }
  .upstream-line-actions {
    grid-area: actions;
  }
  .upstream-line .form-input,
  .upstream-line .form-select {
    min-height: 42px;
    font-size: 12px;
  }
  .upstream-line-field::before {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .form-list-row.upstream-header-row {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
  }
  .upstream-header-row .form-input {
    grid-column: 1;
  }
  .upstream-header-row .form-row-action {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .site-dynamic-card {
    padding: 17px;
  }
  .site-dynamic-row {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  .site-dynamic-profile {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .site-dynamic-profile select {
    width: 100%;
  }
  .m-dynamic-rule-row {
    grid-template-columns: minmax(0, 1fr) 60px;
  }
  .m-dynamic-rule-type,
  .m-dynamic-rule-value {
    grid-column: 1;
  }
  .m-dynamic-rule-remove {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .site-advanced-body {
    padding: 18px;
  }
  .site-cache-panel-heading {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .site-settings-grid > .cache-limit-group {
    padding: 15px;
  }
  .site-settings-grid,
  .site-cache-options,
  .site-cache-rules-body {
    grid-template-columns: 1fr;
  }
  .site-cache-options {
    gap: 18px;
  }
  .cache-limit-grid {
    gap: 12px;
  }
  .site-advanced-summary {
    padding-inline: 18px;
  }
  .form-input,
  .form-select {
    font-size: 16px;
  }
  .login-card .form-input {
    font-size: 16px;
  }
  .site-config-modal .form-input,
  .site-config-modal .form-select {
    font-size: 16px;
  }
  #toast-container {
    right: 20px;
    bottom: max(20px, env(safe-area-inset-bottom));
  }
  .toast {
    padding: 13px 16px;
    font-size: 12px;
  }
  .workspace-footer {
    margin-top: 32px;
    font-size: 12px;
  }
  #page-login {
    padding: 28px 24px;
    place-items: start center;
  }
  .auth-layout {
    display: flex;
    flex-direction: column;
    max-width: 420px;
    min-height: calc(100dvh - 56px);
  }
  .auth-story {
    padding: 8px 0 0;
    border: 0;
  }
  .auth-wordmark {
    font-size: 23px;
  }
  .auth-wordmark-label {
    margin-left: auto;
    padding-left: 0;
    border: 0;
    font-size: 12px;
  }
  .auth-story-content,
  .auth-story-footer {
    display: none;
  }
  .auth-form-area {
    flex: 1;
    width: 100%;
    padding: 56px 0 70px;
  }
  .login-card {
    max-width: none;
  }
  .login-brand {
    margin-bottom: 32px;
  }
  .login-brand h2 {
    font-size: 29px;
  }
  .login-brand p {
    font-size: 12px;
  }
  .auth-form-footer {
    left: 0;
    right: 0;
    bottom: 8px;
    font-size: 12px;
  }
  .is-setup .auth-form-area {
    padding-top: 38px;
    padding-bottom: 70px;
  }
  .is-setup .login-card .form-help {
    font-size: 12px;
  }
  .login-card .form-group > label {
    font-size: 12px;
  }
}
@media (max-width: 380px) {
  .main {
    padding-inline: 15px;
  }
  .site-card {
    padding: 18px;
  }
  .section-title {
    font-size: 23px;
  }
  .site-actions .btn-ghost {
    padding-inline: 10px;
  }
  .site-modal-tabs {
    gap: 14px;
  }
  .site-config-modal .modal-body {
    padding-inline: 15px;
  }
  .settings-panel {
    padding-inline: 17px;
  }
  .settings-choice {
    flex-direction: column;
  }
  .settings-choice button {
    width: 100%;
  }
  .account-settings-card {
    padding: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.tls-source-fields {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}
.tls-source-fields[hidden] {
  display: none;
}
.settings-field > input,
.settings-field > select {
  min-width: 0;
  width: 100%;
}
.diagnostics-layout {
  max-width: 1440px;
  margin-inline: auto;
}

.site-upstream-line {
  display: grid;
  grid-template-areas: none;
  border: 0;
  background: none;
  min-height: 0;
  grid-template-columns: 90px minmax(0, 1fr) 70px auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
}
.site-upstream-line.is-primary {
  grid-template-columns: 90px minmax(0, 1fr) 88px;
  align-items: start;
  padding: 0;
}
.site-upstream-line.is-primary > label {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
}
.site-upstream-line.is-primary > label > span {
  color: var(--white-60);
  font-size: 12px;
  font-weight: 400;
}
.site-upstream-line.is-primary > .upstream-line-latency {
  grid-column: 1 / -1;
  text-align: left;
}
.site-upstream-line .upstream-line-latency,
.site-upstream-line .upstream-line-actions {
  grid-area: auto;
  padding: 0;
  min-height: 0;
}
.site-upstream-line .upstream-line-latency::before,
.site-upstream-line .upstream-line-actions::before {
  display: none;
}
.site-backup-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.site-failover-options {
  margin-block: 16px;
}
.site-failover-options > summary,
.site-header-options > summary,
#m-auto-options > summary {
  cursor: pointer;
  color: var(--white-87);
  font-weight: 500;
}
.site-header-options-body {
  padding-top: 16px;
}
#m-auto-options[open] > summary {
  margin-bottom: 18px;
}
.site-modal-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 768px) {
  .site-upstream-line {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .site-upstream-line > .upstream-line-address {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .site-upstream-line > .upstream-line-actions {
    grid-column: 2;
    grid-row: 1;
  }
  .site-upstream-line > .upstream-line-latency {
    grid-column: 1 / -1;
    text-align: left;
  }
  .site-upstream-line.is-primary {
    grid-template-columns: minmax(0, 1fr) 96px;
  }
  .site-upstream-line.is-primary > .site-primary-address {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .site-upstream-line.is-primary > .site-primary-port {
    grid-column: 2;
    grid-row: 1;
  }
  .site-upstream-line.is-primary > .upstream-line-latency {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 0;
    text-align: left;
  }
  .site-upstream-line.is-primary .form-input,
  .site-upstream-line.is-primary .form-select {
    min-height: 44px;
    font-size: 16px;
  }
}

.update-release-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
  line-height: 1.8;
  max-height: 360px;
  overflow: auto;
}
#update-summary {
  overflow-wrap: anywhere;
}
#update-summary:empty {
  display: none;
}
