/* Right details drawer styles. */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  pointer-events: none;
}
.drawer.is-open { pointer-events: auto; }
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop-soft);
  opacity: 0;
  transition: opacity 0.14s;
}
.drawer.is-open .drawer__backdrop { opacity: 1; }

/* Lock page scroll while any right drawer is open (prevents background scroll chaining). */
html.has-drawer-open,
html.has-drawer-open body {
  overflow: hidden;
}
body.has-drawer-open {
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}

.drawer__panel {
  position: absolute;
  top: 0; right: 0;
  width: var(--drawer-w);
  max-width: 100%;
  height: 100%;
  background: var(--surface-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.14s ease;
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .drawer__panel { transition: opacity 0.12s; opacity: 0; transform: none; }
  .drawer.is-open .drawer__panel { opacity: 1; }
}

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}
.drawer__head-main { min-width: 0; flex: 1; }
.drawer__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-16);
  font-weight: 800;
}
.drawer__subtitle {
  margin-top: 4px;
  font-size: var(--fs-12);
  color: var(--text-muted);
  font-weight: 600;
}
.drawer__head-nav { display: flex; gap: 2px; flex: none; }

.drawer__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 20px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.drawer__section { margin-top: 18px; }
.qm-toolbar + .drawer-tabs { margin-top: 0; }
.drawer-tabs + .drawer__section { margin-top: 10px; }
.drawer__section-title {
  font-size: var(--fs-11);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.drawer-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.drawer-tab {
  flex: none;
  padding: 8px 12px 10px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.is-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--blue-soft);
}
.drawer-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.drawer-activity-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}

.drawer__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.drawer__actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.drawer__actions-row .btn { flex: 1; min-width: 120px; justify-content: center; }

.drawer__footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: var(--fs-12);
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer__link-out {
  margin-top: 14px;
}

.drawer-error {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-secondary);
}
.drawer-error .icon { width: 28px; height: 28px; color: var(--danger); margin-bottom: 8px; }

.drawer-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.drawer-quick-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

/* Quick Manage — toolbar hierarchy */
.qm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
}

.qm-workspace {
  width: 100%;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease;
}

.qm-workspace .icon {
  width: 14px;
  height: 14px;
}

/* Action grid — 2 columns, full labels */
.qm-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-items: stretch;
}

/* Compact quick actions — transparent shell, blue sweep on hover */
.quick-action {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.quick-action::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 0;
}

.quick-action__inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.quick-action .icon {
  width: 13px;
  height: 13px;
  flex: none;
}

.quick-action__inner > span {
  min-width: 0;
  white-space: nowrap;
  line-height: 1.2;
}

.quick-action:hover {
  color: var(--text-on-blue);
  border-color: var(--blue);
  transform: translateY(-1px);
}

.quick-action:hover::before {
  transform: scaleX(1);
}

.quick-action:active {
  transform: translateY(0);
  transition-duration: 80ms;
}

.quick-action:active::before {
  transform: scaleX(1);
  background: var(--primary-hover);
}

.quick-action:focus {
  outline: none;
}

.quick-action:focus-visible {
  box-shadow: var(--focus-ring);
}

.quick-action:focus-visible:not(:hover) {
  border-color: var(--blue);
}

/* Stop Proxy — discrete danger hint, same shape as siblings */
.quick-action--stop {
  color: var(--danger);
}

.quick-action--stop:hover {
  color: var(--text-on-blue);
}

.quick-action:disabled,
.quick-action--disabled {
  color: var(--text-disabled);
  background: var(--surface-2);
  border-color: var(--border-soft);
  cursor: not-allowed;
}

.quick-action:disabled::before,
.quick-action:disabled:hover::before {
  transform: scaleX(0);
}

.quick-action:disabled:hover {
  color: var(--text-disabled);
  border-color: var(--border-soft);
  transform: none;
}

.quick-action--stop:disabled:hover {
  color: var(--danger);
}

.drawer__meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-muted);
}
.drawer__meta-sep {
  margin: 0 6px;
  color: var(--text-muted);
}
.drawer__meta .status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.drawer__meta .status__label {
  font-size: var(--fs-12);
  font-weight: 600;
}

.drawer-hint { margin: 0 0 10px; }
.drawer-empty { padding: 8px 0 4px; font-size: 13px; }
.drawer-endpoint { margin-top: 0; }
.drawer-endpoint.endpoint-item,
.drawer-endpoint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-12);
}
.drawer-endpoint__url {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
}

.drawer-rotation-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer-rotation-list .drawer-endpoint,
.drawer-rotation-list .drawer-endpoint--plain {
  align-items: flex-start;
  gap: 6px 8px;
  padding: 4px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  transition: none;
}
.drawer-rotation-list .drawer-endpoint:hover,
.drawer-rotation-list .drawer-endpoint--plain:hover {
  background: transparent;
  border-color: transparent;
}
.drawer-rotation-list__num {
  flex: none;
  width: 18px;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.drawer-rotation-list .drawer-endpoint__url {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--blue);
  text-decoration: none;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-all;
}
.drawer-rotation-list .drawer-endpoint__url:hover {
  text-decoration: underline;
}
.drawer-rotation-list .drawer-endpoint__url:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 2px;
}
.drawer-rotation-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.drawer-rotation-actions > button { margin: 0; flex: none; }
.drawer-rotation-delete {
  flex: none;
  margin-top: -2px;
}
.drawer-rotation-add {
  margin-top: 10px;
}
.drawer-endpoint__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drawer-endpoint__meta { font-size: 10px; color: var(--text-muted); }
.drawer-endpoint__meta.is-soon { color: var(--warn-text); }
.drawer-endpoint__meta.is-expired { color: var(--danger-text); }
.drawer-rotation-list .drawer-endpoint--plain.is-new { border-radius: 6px; animation: drawer-url-new 2.4s ease-out; }
@keyframes drawer-url-new { from { background: var(--blue-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .drawer-rotation-list .drawer-endpoint--plain.is-new { animation: none; }
}
.drawer-url-new {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.drawer-url-new__title { font-size: 12px; font-weight: 700; }
.drawer-url-new__summary { margin: 0; font-size: 11px; color: var(--text-muted); }
.drawer-url-new .form-error { margin: 0; }
.drawer-url-new__actions { display: flex; justify-content: flex-end; gap: 6px; }

.drawer-vpn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.drawer-vpn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-vpn-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background 120ms ease, border-color 120ms ease;
}
.drawer-vpn-card:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.drawer-vpn-card__head {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.drawer-vpn-card__title {
  font-size: 12px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.drawer-vpn-card__actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: none;
}
.drawer-vpn-card__meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.drawer-vpn-card__dns {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.drawer-vpn-card__meta .drawer-port-item__expiry {
  flex: none;
}
.drawer__status-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  font-weight: 600;
  color: var(--text-secondary);
}
.drawer-ports-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.drawer-port-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-port-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background 120ms ease, border-color 120ms ease;
}
.drawer-port-item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.drawer-port-item__head {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.drawer-port-item__actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex: none;
}
.drawer-port-item__meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.drawer-port-item__desc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.drawer-port-item__expiry {
  flex: none;
  white-space: nowrap;
  user-select: all;
  text-align: right;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.drawer-port-status {
  display: inline-flex;
  align-items: center;
  flex: none;
}
.drawer-port-status .status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.drawer-port-status--active .status__dot { background: var(--ok); }
.drawer-port-status--expired .status__dot { background: var(--danger); }
.drawer-port-status--disabled .status__dot { background: var(--text-muted); }
.drawer-port-status--error .status__dot { background: var(--danger); }
.drawer-port-item__expiry.expiry--ok {
  color: var(--ok);
}
.drawer-port-item__expiry.expiry--warn {
  color: var(--warn-text);
}
.drawer-port-item__expiry.expiry--danger {
  color: var(--danger);
}
.drawer-port-item__num { font-weight: 800; }

.drawer-port-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 120ms ease, background 120ms ease;
}

.drawer-port-act--icon {
  width: 26px;
  height: 26px;
  padding: 0;
  flex: none;
}

.drawer-port-act .icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.drawer-port-act:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.drawer-port-act--danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.drawer-port-act.is-copied {
  color: var(--ok);
}

/* Quick Port Settings popover */
.popover--port-settings {
  width: min(320px, calc(100vw - 24px));
  max-width: min(320px, calc(100vw - 24px));
  padding: 12px;
}

.port-qsettings__head {
  margin-bottom: 10px;
}

.port-qsettings__title {
  font-size: var(--fs-14);
  font-weight: 800;
  color: var(--text);
}

.port-qsettings__meta {
  margin-top: 2px;
  font-size: var(--fs-12);
  color: var(--text-muted);
}

.port-qsettings__field {
  margin-bottom: 10px;
}

.port-qsettings__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.port-qsettings__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.port-qsettings__value {
  display: block;
  font-size: var(--fs-13);
  color: var(--text);
  word-break: break-all;
}

.port-qsettings__pwd {
  display: flex;
  align-items: center;
  gap: 6px;
}

.port-qsettings__pwd-val {
  flex: 1;
  min-width: 0;
}

.port-qsettings__pwd-toggle {
  width: 28px;
  height: 28px;
  flex: none;
}

.port-qsettings__pwd-toggle .icon {
  width: 15px;
  height: 15px;
}

.port-qsettings__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.port-qsettings__preset {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.port-qsettings__preset:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.port-qsettings__preset:disabled {
  color: var(--text-disabled);
  border-color: var(--border-soft);
  cursor: not-allowed;
}

.port-qsettings__custom {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--blue);
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
}

.port-qsettings__custom:hover:not(:disabled) {
  text-decoration: underline;
}

.port-qsettings__custom-input {
  margin-top: 8px;
  width: 100%;
  height: 34px;
  font-size: var(--fs-12);
}

.port-qsettings__custom-dt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-top: 8px;
}

.port-qsettings__custom-dt .dtp {
  min-width: 0;
}

.port-qsettings__custom-dt .port-qsettings__custom-input {
  margin-top: 0;
  min-width: 0;
}

.port-qsettings__error {
  margin: 0 0 8px;
  font-size: var(--fs-12);
  color: var(--danger);
}

.port-qsettings__copy {
  margin-top: 4px;
  justify-content: center;
}

.port-qsettings__footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.port-qsettings__delete {
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--danger);
  font-size: var(--fs-12);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.port-qsettings__delete:hover:not(:disabled) {
  text-decoration: underline;
}

.port-qsettings__delete:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* Create port — compact inline form */
.drawer-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--fs-16);
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}
.drawer-back-btn .icon { width: 18px; height: 18px; color: var(--text-secondary); }
.drawer-back-btn:hover .icon { color: var(--text); }

.drawer-create-port { padding: 0; min-width: 0; }

/* Compact Quick Manage create/edit forms — fit without page scroll. */
.cp-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.drawer-ports-head .btn--sm,
.drawer-vpn-head .btn--sm {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  gap: 4px;
}
.drawer-ports-head .btn--sm .icon,
.drawer-vpn-head .btn--sm .icon {
  width: 13px;
  height: 13px;
}

.drawer__scroll:has(.qm-toolbar) {
  padding: 10px 14px 14px;
}

.drawer__scroll:has(.cp-form) {
  padding: 10px 14px 12px;
}

.cp-endpoint {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.cp-copy-proxy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: -2px 0 0;
  padding: 4px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.cp-copy-proxy .icon {
  width: 12px;
  height: 12px;
}
.cp-copy-proxy:hover {
  color: var(--blue);
  border-color: var(--blue-border);
  background: var(--blue-soft);
}
.cp-copy-proxy.is-copied {
  color: var(--ok);
  border-color: var(--ok-border);
  background: var(--ok-soft);
}
.cp-block { margin: 0; padding: 0; border: none; min-width: 0; }
.cp-block + .cp-block { margin-top: 0; }

.cp-label {
  display: block;
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.cp-block > .cp-label:first-child,
.cp-field > .cp-label:first-child { margin-top: 0; }

.cp-segment {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-sizing: border-box;
  overflow: hidden;
  max-width: 100%;
}
.cp-segment__btn {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  padding: 0 5px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-segment__btn:hover { color: var(--text); }
.cp-segment__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cp-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* Protocol + IP version: always stack — 4 IP options cannot share a half-row. */
.cp-grid-2--proto {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.cp-grid-2--proto .cp-block {
  flex: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
.cp-grid-2--proto .cp-segment {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.cp-grid-2--proto .cp-block--ipver .cp-segment__btn {
  padding: 0 4px;
  font-size: 10px;
  letter-spacing: -0.02em;
}
.cp-segment--sm .cp-segment__btn {
  padding: 0 5px;
  height: 24px;
  font-size: 10.5px;
}
@media (max-width: 380px) {
  .cp-grid-2 { grid-template-columns: 1fr; }
}

/* Quick Manage — mobile: Protocol / IP version stack + compact type (no overflow). */
@media (max-width: 767px) {
  .cp-grid-2--proto {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }
  .cp-grid-2--proto .cp-block {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .cp-segment {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 2px;
    padding: 2px;
    overflow: hidden;
  }
  .cp-segment__btn {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cp-segment--sm .cp-segment__btn {
    padding: 0 4px;
  }
  /* IP version: horizontal icon-above-label row (Ports + VPN). */
  .cp-block--ipver .cp-segment,
  .cp-block--ipver .cp-segment--icons,
  .cp-grid-2--proto .cp-block--ipver .cp-segment,
  .cp-grid-2--proto .cp-block--ipver .cp-segment--icons {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }
  .cp-block--ipver .cp-segment__btn,
  .cp-block--ipver .cp-segment__btn--icon,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__btn,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__btn--icon {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 40px;
    padding: 4px 2px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 0;
    font-size: 8.5px;
    font-weight: 650;
    line-height: 1.05;
    letter-spacing: -0.02em;
    white-space: normal;
    text-align: center;
    overflow: hidden;
    text-overflow: unset;
  }
  .cp-block--ipver .cp-segment__btn + .cp-segment__btn,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__btn + .cp-segment__btn {
    border-left: 1px solid var(--border-soft);
  }
  .cp-block--ipver .cp-segment__btn.is-active,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__btn.is-active {
    background: var(--blue-soft);
    color: var(--blue);
    box-shadow: none;
  }
  .cp-block--ipver .cp-segment__ico,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
  }
  .cp-block--ipver .cp-segment__ico .icon,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__ico .icon {
    width: 14px;
    height: 14px;
  }
  .cp-block--ipver .cp-segment__txt,
  .cp-grid-2--proto .cp-block--ipver .cp-segment__txt {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cp-meta--ipver-lead {
    display: none;
  }
  .cp-block--allowlist > .cp-meta:first-of-type {
    display: none;
  }
  .cp-label {
    font-size: 9.5px;
  }
  .cp-help,
  .cp-meta {
    font-size: 9.5px;
  }
  .cp-endpoint {
    font-size: 11px;
  }
  .cp-copy-proxy {
    font-size: 10.5px;
  }
  .cp-input,
  .cp-input-wrap .cp-input {
    font-size: 12px;
  }
  .cp-field .cp-label,
  .cp-block .cp-label {
    font-size: 9.5px;
  }
  .qm-workspace {
    height: 28px;
    min-height: 28px;
    font-size: 11.5px;
  }
  .drawer-ports-head,
  .drawer-vpn-head {
    margin-bottom: 6px;
  }
}

.cp-field { min-width: 0; }

.cp-input-wrap {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding-right: 1px;
}
.cp-input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
}
.cp-input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
}
.cp-input:focus { outline: none; }
.cp-input-wrap .cp-input { box-shadow: none; }

.cp-field > .cp-input,
.cp-block > .cp-input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
}
.cp-field > .cp-input:focus,
.cp-block > .cp-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
  outline: none;
}

.cp-textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 72px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  resize: vertical;
  box-sizing: border-box;
}
.cp-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
  outline: none;
}
.cp-textarea::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}
.cp-block--allowlist .cp-meta {
  margin: 0 0 3px;
}
.cp-block--allowlist .cp-meta + .cp-textarea {
  margin-top: 0;
}
.cp-block--allowlist .cp-textarea + .cp-meta {
  margin: 3px 0 0;
}
/* Standalone IP version (VPN form) — full-width equal segments. */
.cp-block--ipver > .cp-segment {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.cp-block--ipver > .cp-segment .cp-segment__btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
  font-size: 10px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-input-action {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.cp-input-action:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
}
.cp-input-action .icon { width: 12px; height: 12px; }

.cp-error {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--danger);
}
.cp-error--block { margin-bottom: 2px; }

.cp-exp-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.cp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.cp-preset {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.cp-preset:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.cp-meta {
  margin: 1px 0 0;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

.cp-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.cp-footer .btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.cp-footer__end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}
.cp-form--vpn .cp-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.cp-form--vpn .cp-input {
  font-size: 12px;
}
.cp-delete-btn {
  color: var(--danger) !important;
  min-width: 34px;
  padding: 0 10px !important;
}
.cp-delete-btn .icon {
  width: 16px;
  height: 16px;
}
.cp-delete-btn:hover:not(:disabled) {
  color: var(--danger) !important;
  background: var(--danger-soft) !important;
}
.cp-delete-btn:disabled {
  color: var(--text-disabled);
}

.drawer-port-item.is-new {
  background: var(--blue-soft);
  border-color: var(--blue-border-soft);
  animation: drawer-port-new 3s ease-out forwards;
}
@keyframes drawer-port-new {
  0% {
    background: var(--blue-soft-2);
    border-color: var(--blue-border-soft);
  }
  100% {
    background: var(--surface);
    border-color: var(--border);
  }
}

@media (max-width: 1280px) {
  .drawer__panel { width: min(440px, 92vw); }
}
@media (max-width: 1024px) {
  .drawer__panel { width: min(100vw - 24px, 480px); }
}

/* Configure permissions drawer */
.drawer--sa-perms {
  z-index: calc(var(--z-modal) + 2);
}
.drawer__panel--sa-perms {
  width: min(720px, 100%);
}
.drawer__panel--sa-perms .drawer__scroll--sa-perms {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.sa-pdraw {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  flex: 1;
}
.sa-pdraw__top {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 22px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-elevated, var(--surface));
}
.sa-pdraw__count {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text);
}
.sa-pdraw__match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.sa-pdraw__search-input {
  width: 100%;
}
.sa-pdraw__main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
}
.sa-pdraw__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 16px 14px;
  border-right: 1px solid var(--border-soft);
  overflow: auto;
  min-height: 0;
  background: var(--surface-2, var(--bg));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sa-pdraw__nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--text-secondary);
}
.sa-pdraw__nav-item:hover {
  background: var(--hover);
  color: var(--text);
}
.sa-pdraw__nav-item.is-active {
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 28%, transparent);
}
.sa-pdraw__nav-label {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-12);
  font-weight: 650;
}
.sa-pdraw__nav-count {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.sa-pdraw__nav-item.is-active .sa-pdraw__nav-count {
  color: var(--blue);
}
.sa-pdraw__nav-chev {
  display: none;
  color: var(--text-muted);
  flex: none;
}
.sa-pdraw__nav-chev .icon { width: 14px; height: 14px; }
.sa-pdraw__panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sa-pdraw__panel-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.sa-pdraw__panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.sa-pdraw__panel-title {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--text);
}
.sa-pdraw__panel-count {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  white-space: nowrap;
}
.sa-pdraw__panel-desc {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}
.sa-pdraw__panel-acts {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sa-pdraw__text-act {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.sa-pdraw__text-act:hover { text-decoration: underline; }
.sa-pdraw__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: var(--fs-12);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
}
.sa-pdraw__back .icon { width: 14px; height: 14px; }
.sa-pdraw__section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.sa-pdraw__section.is-first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.sa-pdraw__section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
  padding: 0 2px;
}
.sa-pdraw__rows {
  display: flex;
  flex-direction: column;
}
.sa-pdraw__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.sa-pdraw__row:last-child { border-bottom: 0; }
.sa-pdraw__row:hover { background: transparent; }
.sa-pdraw__row--ro { cursor: default; }
.sa-pdraw__row--ro.is-off { opacity: 0.55; }
.sa-pdraw__row-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sa-pdraw__row-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--fs-13);
  font-weight: 650;
  color: var(--text);
}
.sa-pdraw__row-help {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}
.sa-pdraw__dep {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.sa-pdraw__tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-2, var(--bg));
}
.sa-pdraw__tag--sensitive {
  color: var(--warn-text, #9a6700);
  border-color: var(--warn-border, #f0d9a0);
  background: var(--warn-soft, #fff7e8);
}
.sa-pdraw__tag--destructive {
  color: var(--danger-text, var(--danger));
  border-color: var(--danger-border, transparent);
  background: var(--danger-soft, rgba(220, 38, 38, 0.08));
}
.sa-pdraw__tag--privileged {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-soft);
}
.sa-pdraw__tag--billing {
  color: var(--text-secondary);
  border-color: var(--border);
}
.sa-pdraw__ro {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex: none;
  margin-top: 2px;
}
.sa-pdraw__row--ro.is-on .sa-pdraw__ro {
  color: var(--ok-text, var(--blue));
}
.sa-pdraw__search-head {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.sa-pdraw__search-group {
  margin-top: 10px;
}
.sa-pdraw__search-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sa-pdraw__empty {
  margin: 24px 0;
  text-align: center;
  font-size: var(--fs-12);
  color: var(--text-muted);
}
.sa-pdraw-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-elevated, var(--surface));
}
.sa-pdraw-foot--ro {
  justify-content: flex-end;
}
.sa-pdraw-foot__count {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
}
.sa-pdraw-foot__acts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 720px) {
  .drawer__panel--sa-perms {
    width: 100%;
  }
  .sa-pdraw__main {
    grid-template-columns: 1fr;
  }
  .sa-pdraw__nav {
    border-right: 0;
    padding: 10px 14px 16px;
  }
  .sa-pdraw__nav-chev { display: inline-flex; }
  .sa-pdraw.is-detail .sa-pdraw__nav { display: none; }
  .sa-pdraw:not(.is-detail) .sa-pdraw__panel { display: none; }
  .sa-pdraw__panel {
    padding: 12px 16px 18px;
  }
  .sa-pdraw__top {
    padding: 10px 16px;
  }
  .sa-pdraw-foot {
    padding: 12px 16px;
  }
}
.drawer-gp__title-ico {
  display: inline-flex;
  color: var(--text-muted);
  margin-right: 2px;
}
.drawer-gp__title-ico .icon { width: 16px; height: 16px; }
.drawer-gp {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-gp.is-policy-off > .drawer-gp__section,
.drawer-gp.is-policy-off > .drawer-gp__dest {
  opacity: 0.55;
  pointer-events: none;
}
.drawer-gp__enabled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-gp__enabled-label {
  font-size: var(--fs-13);
  font-weight: 700;
  color: var(--text);
}
.drawer-gp__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-gp__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.drawer-gp__section-head .drawer-gp__label {
  margin: 0;
}
.drawer-gp__section-switch {
  display: inline-flex;
  align-items: center;
  flex: none;
  cursor: pointer;
}
.drawer-gp__section.is-section-off > .drawer-gp__help,
.drawer-gp__section.is-section-off > .drawer-gp__bw,
.drawer-gp__section.is-section-off > .drawer-gp__field,
.drawer-gp__section.is-section-off > .drawer-gp__summary,
.drawer-gp__section.is-section-off > .drawer-gp__alloc {
  opacity: 0.58;
}
.drawer-gp__label {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text);
}
.drawer-gp__field-label {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}
.drawer-gp__field.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.drawer-gp__help {
  margin: 0;
  font-size: var(--fs-11);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}
.drawer-gp__help--banner {
  margin-top: -4px;
}
.drawer-gp__summary {
  margin-top: 2px;
}
.drawer-gp__intro {
  margin: 0 0 12px;
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-muted);
}
.drawer-gp__alloc {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg, #f8fafc);
  border: 1px solid var(--border-soft, #e8edf3);
}
.drawer-gp__alloc-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.drawer-gp__alloc-line {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}
.drawer-gp__alloc-line + .drawer-gp__alloc-line {
  margin-top: 2px;
  color: var(--text-muted);
}
.drawer-gp__alloc-hint {
  margin-top: 8px !important;
  margin-bottom: 4px !important;
}
.drawer-gp__ipver .pp-segment__btn,
.drawer-gp__period .pp-segment__btn {
  flex: 1;
  min-width: 0;
}
.drawer-gp__period.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.drawer-gp__bw {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.drawer-gp__field { min-width: 0; }
.drawer-gp__input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 8px;
  min-height: 36px;
}
.drawer-gp__input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
}
.drawer-gp__input-wrap--allowance {
  width: 100%;
}
.drawer-gp__input-wrap--amt { flex: 1; min-width: 0; }
.drawer-gp__input-wrap:has(input:disabled) {
  opacity: 0.55;
  background: var(--hover, rgba(0, 0, 0, 0.03));
}
.drawer-gp__affix {
  display: inline-flex;
  color: var(--text-muted);
  flex: none;
}
.drawer-gp__affix .icon { width: 14px; height: 14px; }
.drawer-gp__input {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 6px 0 !important;
  min-width: 0;
  flex: 1;
  width: 100%;
}
.drawer-gp__input:disabled {
  opacity: 1;
  cursor: not-allowed;
}
.drawer-gp__unit {
  font-size: var(--fs-11);
  font-weight: 700;
  color: var(--text-muted);
  flex: none;
}
.drawer-gp__radios {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer-gp__radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.drawer-gp__radio:hover {
  background: var(--hover);
}
.drawer-gp__radio.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.drawer-gp__radio input {
  margin-top: 2px;
  flex: none;
  accent-color: var(--blue);
}
.drawer-gp__radio-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.drawer-gp__radio-label {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.drawer-gp__radio-help {
  font-size: var(--fs-11);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.35;
}
.drawer-gp__dest {
  border: 0;
  border-radius: 0;
  overflow: visible;
  margin-top: -4px;
}
.drawer-gp__dest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.drawer-gp__dest-head:hover { color: var(--text); }
.drawer-gp__dest-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.drawer-gp__dest-title {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--text);
}
.drawer-gp__dest-meta {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text-muted);
}
.drawer-gp__dest-chev {
  color: var(--text-muted);
  flex: none;
}
.drawer-gp__dest-chev .icon { width: 16px; height: 16px; }
.drawer-gp__dest-body {
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 0;
}
.drawer-gp__dest-ta {
  min-height: 96px;
  resize: vertical;
}
.drawer-gp__err {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--danger);
}
.drawer-gp-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-elevated);
}
.drawer-gp-foot .btn { min-width: 100px; justify-content: center; }

@media (max-width: 520px) {
  .drawer__panel--gp { width: 100%; }
  .drawer-gp__bw { grid-template-columns: 1fr; }
  .drawer-gp-foot {
    flex-wrap: wrap;
  }
  .drawer-gp-foot .btn { flex: 1; }
}
.cp-form { gap: 14px; }
.cp-form .cp-label { margin-bottom: 7px; font-size: 12px; font-weight: 500; }
.cp-form .cp-meta { margin-top: 6px; line-height: 1.45; font-size: 11px; }
.cp-form .cp-segment__btn { font-size: 12px; font-weight: 500; height: 28px; min-height: 28px; padding: 0 8px; line-height: 1.3; }
.cp-form .cp-grid-2 { gap: 12px; align-items: start; }
.cp-form .cp-grid-2--proto { gap: 14px; }
.cp-form .cp-grid-2 > .cp-field { margin-top: 0; }
.cp-form .cp-input-wrap { height: 36px; box-sizing: border-box; }
.cp-form .cp-input-wrap .cp-input { height: 34px; font-size: 13px; font-weight: 400; }
.cp-form .cp-field > .cp-input,
.cp-form .cp-block > input.cp-input { height: 36px; font-size: 13px; font-weight: 400; }
.cp-form .cp-segment { padding: 2px; gap: 2px; }
[data-theme="dark"] .cp-form .cp-segment { background: var(--surface-2); border: 1px solid var(--border-strong); padding: 2px; gap: 2px; }
[data-theme="dark"] .cp-form .cp-segment .cp-segment__btn.is-active { background: var(--blue-soft-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--blue); border-radius: 6px; }
[data-theme="dark"] .cp-form .cp-segment .cp-segment__btn:not(.is-active) { color: var(--text-secondary); background: transparent; }
.cp-form .cp-segment__btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.port-header-endpoint { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.port-header-endpoint .mono { overflow-wrap: anywhere; min-width: 0; }
.port-header-endpoint .icon-btn { width: 28px; height: 28px; flex-shrink: 0; }

/* Quick Manager expiration: compact mode selector, comfortable preset targets. */
.cp-form .cp-segment:has([data-exp-mode]) { width: fit-content; max-width: 100%; }
.cp-form .cp-segment [data-exp-mode] {
  flex: 0 1 auto; height: 26px; min-height: 26px; padding: 0 12px; font-size: 11px;
}
.cp-form .cp-exp-panel { gap: 10px; margin-top: 10px; }
.cp-form .cp-exp-panel .dtp__control { height: 32px; min-height: 32px; }
.cp-form .cp-exp-panel .dtp__input { font-size: 12px; }
.cp-form .cp-presets { gap: 8px 6px; }
.cp-form .cp-preset {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 30px; padding: 4px 10px; border-radius: 7px;
  font-size: 11px; font-weight: 500; line-height: 1.3;
}
.cp-form .cp-exp-panel .cp-meta { margin: 0; line-height: 1.4; }
@media (pointer: coarse) {
  .cp-form .cp-segment [data-exp-mode] { height: 34px; min-height: 34px; }
  .cp-form .cp-preset { min-height: 36px; }
}
